ledgerrb/rc.ledgerrb

36 lines
408 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 20:07:21 +02:00
SERVER='bundle exec rackup'
SERVER_OPTIONS=' -D -P ./ledgerrb.pid'
2015-01-11 09:26:37 +01:00
function start() {
$SERVER $SERVER_OPTIONS
}
function stop() {
2015-08-30 22:37:19 +02:00
[ -e ./ledgerrb.pid ] && kill $(cat ./ledgerrb.pid)
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