log1 and nagios cron alerts
Jon Stanley
jonstanley at gmail.com
Sun Nov 9 03:29:15 UTC 2008
2008/11/8 Ricky Zhou <ricky at fedoraproject.org>:
> I think you forgot to rm the lock file when it finishes :-) Otherwise,
> it looks good. If you want to take it a step further and account for
> stale lockfiles, take a look at what Mike did in
> configs/system/syncStatic.sh.
Grr, here's another try:
diff --git a/modules/awstats/templates/awstats.cron.erb
b/modules/awstats/templates/awstats.cron.erb
index 7e41be0..825d4e9 100755
--- a/modules/awstats/templates/awstats.cron.erb
+++ b/modules/awstats/templates/awstats.cron.erb
@@ -1,6 +1,14 @@
#!/bin/bash
# <%= name %>
+
+if [ -e /var/lock/subsys/<%= name %>.awstats.lock ] ; then
+ if `ps $(cat /var/lock/subsys/<%= name %>.awstats.lock) > /dev/null` ; then
+ exit 1
+ fi
+fi
+
+echo $$ > /var/lock/subsys/<%= name %>.awstats.lock
mkdir -p /srv/web/awstats/<%= name %>
/usr/share/awstats/tools/awstats_buildstaticpages.pl \
@@ -10,3 +18,5 @@ mkdir -p /srv/web/awstats/<%= name %>
ln -sf \
/srv/web/awstats/<%= name %>/awstats.<%= name %>.html \
/srv/web/awstats/<%= name %>/index.html
+
+rm /var/lock/subsys/<%= name %>.awstats.lock
More information about the Fedora-infrastructure-list
mailing list