Files
ircnet.ipng.ch/cron/update.cron
ircnet b103e1d56d Added a config checker. Lame that chkconf does not return != 0 if there are errors, so we have to grep around in its output :(
git-svn-id: svn+ssh://svn.ipng.nl/usr/share/subversion/repositories/ircnet.ipng.ch@28 c5d60b8d-fdcb-4146-b734-af4215e9eb71
2009-09-07 21:12:42 +00:00

32 lines
837 B
Plaintext

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 "Checking config"
[ "`/home/ircd/ircd/sbin/chkconf 2>&1 | grep ERROR`" != "" ] && \
fatal "Configuration is invalid at HEAD!"
echo "Sending -HUP to the ircd"
pkill -HUP ircd || error "Could not send HUP to ircd"
}
rm -f -- $DIFF
}