ledgerrb/rc.ledgerrb

38 lines
447 B
Text
Raw Normal View History

2014-07-31 18:51:55 +02:00
#!/bin/sh
2015-01-11 09:39:03 +01:00
CWD=$(pwd)
2015-01-11 09:36:44 +01:00
2015-08-30 22:41:46 +02:00
PIDFILE=./ledgerrb.pid
PORT=9292
2015-08-30 22:47:50 +02:00
SERVER='bundle exec puma'
SERVER_OPTIONS=' --daemon --pidfile $PIDFILE --port $PORT'
2015-01-11 09:26:37 +01:00
function start() {
$SERVER $SERVER_OPTIONS
}
function stop() {
2015-08-30 22:41:46 +02:00
[ -e $PIDFILE ] && kill $(cat $PIDFILE)
2015-01-11 09:26:37 +01:00
}
function restart() {
stop && sleep 3 && start
}
2014-07-31 18:51:55 +02:00
case $1 in
"start")
2015-01-11 09:26:37 +01:00
start
2014-07-31 18:51:55 +02:00
;;
"stop")
2015-01-11 09:26:37 +01:00
stop
2014-07-31 18:51:55 +02:00
;;
"restart")
2015-01-11 09:26:37 +01:00
restart
2014-07-31 18:51:55 +02:00
;;
*)
echo "Usage; start|stop|restart"
;;
esac