diff options
Diffstat (limited to 'bin/mail_room')
-rwxr-xr-x | bin/mail_room | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/bin/mail_room b/bin/mail_room new file mode 100755 index 00000000000..0fabfa778b7 --- /dev/null +++ b/bin/mail_room @@ -0,0 +1,51 @@ +#!/bin/sh + +cd $(dirname $0)/.. +app_root=$(pwd) + +mail_room_pidfile="$app_root/tmp/pids/mail_room.pid" +mail_room_config="$app_root/config/mail_room.yml" + +get_mail_room_pid() +{ + local pid=$(cat $mail_room_pidfile) + if [ -z "$pid" ] ; then + echo "Could not find a PID in $mail_room_pidfile" + exit 1 + fi + mail_room_pid=$pid +} + +start() +{ + bundle exec mail_room -q -c $mail_room_config + PID=$! + echo $PID > $mail_room_pidfile +} + +stop() +{ + get_mail_room_pid + kill -QUIT $mail_room_pid +} + +reload() +{ + get_mail_room_pid + kill -USR2 $mail_room_pid +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + reload) + reload + ;; + *) + echo "Usage: $0 {start|stop|reload}" + ;; +esac |