diff options
-rw-r--r-- | config/alert-tracks-debian.ugly | 52 | ||||
-rw-r--r-- | config/crontab.ugly | 4 | ||||
-rwxr-xr-x | script/alert-tracks-daemon | 6 |
3 files changed, 60 insertions, 2 deletions
diff --git a/config/alert-tracks-debian.ugly b/config/alert-tracks-debian.ugly new file mode 100644 index 000000000..8c2acdbb9 --- /dev/null +++ b/config/alert-tracks-debian.ugly @@ -0,0 +1,52 @@ +#!/bin/bash +# +### BEGIN INIT INFO +# Provides: alert-tracks +# Required-Start: $local_fs $syslog +# Required-Stop: $local_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: alert-tracks is a daemon running the WhatDoTheyKnow email alerts +# Description: alert-tracks send WhatDoTheyKnow email alerts as required +### END INIT INFO +# +# !!(*= $daemon_name *)!! Start the WhatDoTheyKnow email alert daemon + +NAME=!!(*= $daemon_name *)!! +DAEMON=/data/vhost/!!(*= $vhost *)!!/alaveteli/script/alert-tracks-daemon +PIDFILE=/data/vhost/!!(*= $vhost *)!!/alert-tracks.pid +DUSER=!!(*= $user *)!! + +trap "" 1 + +case "$1" in + start) + echo -n "Starting WhatDoTheyKnow alert daemon: $NAME" + start-stop-daemon --start --pidfile $PIDFILE --chuid $DUSER --exec $DAEMON > /dev/null + ;; + + stop) + echo -n "Stopping WhatDoTheyKnow alert daemon: $NAME" + start-stop-daemon --stop --pidfile $PIDFILE --oknodo + ;; + + restart) + echo -n "Restarting WhatDoTheyKnow alert daemon: $NAME" + start-stop-daemon --stop --pidfile $PIDFILE --oknodo + start-stop-daemon --start --pidfile $PIDFILE --chuid $DUSER --exec $DAEMON > /dev/null + ;; + + *) + echo "Usage: /etc/init.d/$NAME {start|stop|restart}" + exit 1 + ;; +esac + +if [ $? -eq 0 ]; then + echo . + exit 0 +else + echo " failed" + exit 1 +fi + diff --git a/config/crontab.ugly b/config/crontab.ugly index d572e1a9a..9193899af 100644 --- a/config/crontab.ugly +++ b/config/crontab.ugly @@ -11,8 +11,8 @@ MAILTO=cron-!!(*= $site *)!!@mysociety.org # Every 5 minutes */5 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/update-xapian-index.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/update-xapian-index || echo "stalled?" -# Every 10 minutes -5,15,25,35,45,55 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/alert-tracks.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/alert-tracks || echo "stalled?" +# # Every 10 minutes +# 5,15,25,35,45,55 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/alert-tracks.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/alert-tracks || echo "stalled?" # Once an hour 39 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/alert-overdue-requests.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/alert-overdue-requests || echo "stalled?" diff --git a/script/alert-tracks-daemon b/script/alert-tracks-daemon new file mode 100755 index 000000000..7d3c2e4b5 --- /dev/null +++ b/script/alert-tracks-daemon @@ -0,0 +1,6 @@ +#!/bin/bash + +LOC=`dirname $0` + +"$LOC/runner" 'TrackMailer.alert_tracks_loop' + |