2015-08-19 16:58:07 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-10-29 14:09:11 -04:00
|
|
|
cd $(dirname $0)/.. || exit 1
|
2015-08-19 16:58:07 -04:00
|
|
|
app_root=$(pwd)
|
|
|
|
|
|
|
|
mail_room_pidfile="$app_root/tmp/pids/mail_room.pid"
|
2015-08-19 17:27:47 -04:00
|
|
|
mail_room_logfile="$app_root/log/mail_room.log"
|
2015-08-19 16:58:07 -04:00
|
|
|
mail_room_config="$app_root/config/mail_room.yml"
|
|
|
|
|
|
|
|
get_mail_room_pid()
|
|
|
|
{
|
2020-10-29 11:09:12 -04:00
|
|
|
local pid
|
|
|
|
pid=$(cat $mail_room_pidfile)
|
2015-08-19 16:58:07 -04:00
|
|
|
if [ -z "$pid" ] ; then
|
|
|
|
echo "Could not find a PID in $mail_room_pidfile"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
mail_room_pid=$pid
|
|
|
|
}
|
|
|
|
|
|
|
|
start()
|
|
|
|
{
|
2020-02-28 19:07:44 -05:00
|
|
|
bin/daemon_with_pidfile $mail_room_pidfile bundle exec mail_room --log-exit-as json -q -c $mail_room_config >> $mail_room_logfile 2>&1
|
2015-08-19 16:58:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
stop()
|
|
|
|
{
|
|
|
|
get_mail_room_pid
|
2015-08-19 17:27:47 -04:00
|
|
|
kill -TERM $mail_room_pid
|
2015-08-19 16:58:07 -04:00
|
|
|
}
|
|
|
|
|
2015-08-19 17:27:47 -04:00
|
|
|
restart()
|
2015-08-19 16:58:07 -04:00
|
|
|
{
|
2015-08-19 17:27:47 -04:00
|
|
|
stop
|
|
|
|
start
|
2015-08-19 16:58:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
2015-08-19 17:27:47 -04:00
|
|
|
restart)
|
|
|
|
restart
|
2015-08-19 16:58:07 -04:00
|
|
|
;;
|
|
|
|
*)
|
2015-08-19 17:27:47 -04:00
|
|
|
echo "Usage: $0 {start|stop|restart}"
|
2015-08-19 16:58:07 -04:00
|
|
|
;;
|
|
|
|
esac
|