From 55914b0953f33c3d9bee5b1d5c12e15a6cd6295d Mon Sep 17 00:00:00 2001 From: pim Date: Tue, 8 Sep 2009 08:47:29 +0000 Subject: [PATCH] Rename the crontab to something more descriptive. git-svn-id: svn+ssh://svn.ipng.nl/usr/share/subversion/repositories/ircnet.ipng.ch@30 c5d60b8d-fdcb-4146-b734-af4215e9eb71 --- cron/crontab | 2 +- cron/ircd_update.cron | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 cron/ircd_update.cron diff --git a/cron/crontab b/cron/crontab index 441a923..a977bdf 100644 --- a/cron/crontab +++ b/cron/crontab @@ -1 +1 @@ -*/5 * * * * /home/ircd/bin/bitcron /home/ircd/ircd/etc/cron/update.cron +*/5 * * * * /home/ircd/bin/bitcron /home/ircd/ircd/etc/cron/ircd_update.cron diff --git a/cron/ircd_update.cron b/cron/ircd_update.cron new file mode 100644 index 0000000..1e1c786 --- /dev/null +++ b/cron/ircd_update.cron @@ -0,0 +1,28 @@ +NAME="ircd_update" +AUTHOR="Pim van Pelt" +# MAILTO="pim@ipng.nl" +ESCALATE_MAILTO="pim@ipng.nl" +MASTERLOG="/home/ircd/cronscripts/logs/${NAME}.log" + +PATH=/usr/local/bin:/usr/bin:/bin:/home/ircd/bin + +function bitcron_main() +{ + DIFF="/tmp/${NAME}.diff.$$" + + cd ~/ircd/etc || fatal "No config directory" + + svn diff -r HEAD > $DIFF || fatal "Could not read the SVN repository" + + [ ! -r $DIFF ] && fatal "Cannot read diff file" + + [ -s $DIFF ] && { + warning "Incorporating these diffs from the repository" + cat $DIFF + svn update || error "Could not update local copy" + echo "Sending -HUP to the ircd" + pkill -HUP ircd || error "Could not send HUP to ircd" + } + + rm -f -- $DIFF +}