From 1a859e2143668ef2032620e5806171b5c1912e84 Mon Sep 17 00:00:00 2001 From: "chris.boulton" Date: Sun, 27 Mar 2011 16:02:16 +1100 Subject: [PATCH] Add sample monit and logrotate scripts --- extras/resque.logrotate | 10 ++++++++++ extras/resque.monit | 15 +++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 extras/resque.logrotate create mode 100644 extras/resque.monit diff --git a/extras/resque.logrotate b/extras/resque.logrotate new file mode 100644 index 0000000..822c520 --- /dev/null +++ b/extras/resque.logrotate @@ -0,0 +1,10 @@ +/var/log/resque/*.log { + daily + missingok + rotate 7 + compress + compressoptions -4 + notifempty + create 640 root adm + copytruncate +} \ No newline at end of file diff --git a/extras/resque.monit b/extras/resque.monit new file mode 100644 index 0000000..654815d --- /dev/null +++ b/extras/resque.monit @@ -0,0 +1,15 @@ +# Borrowed with modifications from +# https://github.com/defunkt/resque/blob/master/examples/monit/resque.monit +# Replace these with your own: +# [QUEUE] +# [PATH/TO/RESQUE] +# [UID] +# [GID] +# [APP_INCLUDE] + +check process resque_worker_[QUEUE] + with pidfile /var/run/resque/worker_[QUEUE].pid + start program = "/bin/sh -c 'APP_INCLUDE=[APP_INCLUDE] QUEUE=[QUEUE] VERBOSE=1 PIDFILE=/var/run/resque/worker_[QUEUE].pid nohup php -f [PATH/TO/RESQUE]/resque.php > /var/log/resque/worker_[QUEUE].log &'" as uid [UID] and gid [GID] + stop program = "/bin/sh -c 'kill -s QUIT `cat /var/run/resque/worker_[QUEUE].pid` && rm -f /var/run/resque/worker_[QUEUE].pid; exit 0;'" + if totalmem is greater than 300 MB for 10 cycles then restart # eating up memory? + group resque_workers \ No newline at end of file