ledgerrb/rc.ledgerrb
Gwenhael Le Moine 0a211fe876 setup rackcup
2015-08-30 22:41:46 +02:00

37 lines
477 B
Bash
Executable file

#!/bin/sh
CWD=$(pwd)
PIDFILE=./ledgerrb.pid
PORT=9292
SERVER='bundle exec rackup'
SERVER_OPTIONS=' --daemonize --pid $PIDFILE --port $PORT --host 0.0.0.0 --server puma'
function start() {
$SERVER $SERVER_OPTIONS
}
function stop() {
[ -e $PIDFILE ] && kill $(cat $PIDFILE)
}
function restart() {
stop && sleep 3 && start
}
case $1 in
"start")
start
;;
"stop")
stop
;;
"restart")
restart
;;
*)
echo "Usage; start|stop|restart"
;;
esac