aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/alert-tracks-debian.ugly53
-rw-r--r--config/crontab.ugly2
2 files changed, 40 insertions, 15 deletions
diff --git a/config/alert-tracks-debian.ugly b/config/alert-tracks-debian.ugly
index 6dfa811a4..3263002a1 100644
--- a/config/alert-tracks-debian.ugly
+++ b/config/alert-tracks-debian.ugly
@@ -13,33 +13,58 @@
# !!(*= $daemon_name *)!! Start the WhatDoTheyKnow email alert daemon
NAME=!!(*= $daemon_name *)!!
-DAEMON=/data/vhost/!!(*= $vhost *)!!/alaveteli/script/alert-tracks-daemon
+DAEMON=/data/vhost/!!(*= $vhost *)!!/alaveteli/script/runner
+DAEMON_ARGS="--daemon TrackMailer.alert_tracks_loop"
PIDFILE=/data/vhost/!!(*= $vhost *)!!/alert-tracks.pid
+LOGFILE=/data/vhost/!!(*= $vhost *)!!/logs/alert-tracks.log
DUSER=!!(*= $user *)!!
trap "" 1
export PIDFILE
+quietly_start_daemon() {
+ start-stop-daemon --quiet --start --pidfile "$PIDFILE" --chuid "$DUSER" --startas "$DAEMON" -- $DAEMON_ARGS
+}
+
+start_daemon() {
+ start-stop-daemon --start --pidfile "$PIDFILE" --chuid "$DUSER" --startas "$DAEMON" -- $DAEMON_ARGS \
+ > "$LOGFILE" 2>&1
+}
+
+stop_daemon() {
+ start-stop-daemon --stop --pidfile "$PIDFILE"
+}
+
+restart() { stop; start; }
+
case "$1" in
+ check)
+ quietly_start_daemon
+ if [ $? -ne 1 ]
+ then
+ echo "WhatDoTheyKnow alert daemon was not running; restarting now"
+ fi
+ ;;
+
start)
- echo -n "Starting WhatDoTheyKnow alert daemon: $NAME"
- start-stop-daemon --start --pidfile $PIDFILE --chuid $DUSER --exec $DAEMON > /dev/null
- ;;
-
+ echo -n "Starting WhatDoTheyKnow alert daemon: $NAME"
+ start_daemon
+ ;;
+
stop)
- echo -n "Stopping WhatDoTheyKnow alert daemon: $NAME"
- start-stop-daemon --stop --pidfile $PIDFILE --oknodo
- ;;
-
+ echo -n "Stopping WhatDoTheyKnow alert daemon: $NAME"
+ stop_daemon
+ ;;
+
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 -n "Restarting WhatDoTheyKnow alert daemon: $NAME"
+ stop_daemon
+ start_daemon
+ ;;
*)
- echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
+ echo "Usage: /etc/init.d/$NAME {start|stop|restart|check}"
exit 1
;;
esac
diff --git a/config/crontab.ugly b/config/crontab.ugly
index 9193899af..d67eec769 100644
--- a/config/crontab.ugly
+++ b/config/crontab.ugly
@@ -12,7 +12,7 @@ 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?"
+5,15,25,35,45,55 * * * * !!(*= $user *)!! /etc/init.d/foi-alert-tracks check
# 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?"