Created
January 19, 2016 19:26
-
-
Save jgrocha/c93530815252991a75f2 to your computer and use it in GitHub Desktop.
Startup script for OpenTripPlanner (/etc/init.d/opentripplanner)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NAME=opentripplanner | |
JAR=/home/jgr/otp/otp-0.19.0-SNAPSHOT-shaded.jar | |
BASE=/home/jgr/otp | |
PIDFILE="/var/run/$NAME.pid" | |
case $1 in | |
start) | |
echo "Starting $NAME ..." | |
if [ ! -f $PIDFILE ]; then | |
cd $BASE | |
nohup java -Xmx4G -jar $JAR --server --port 9090 --securePort 9091 --basePath $BASE --graphs graphs --router portugal --autoReload --analyst --insecure 2>> /dev/null >> /dev/null & | |
echo $! > $PIDFILE | |
echo "$NAME started ..." | |
else | |
echo "$NAME is already running ..." | |
fi | |
;; | |
stop) | |
if [ -f $PIDFILE ]; then | |
PID=$(cat $PIDFILE); | |
echo "$NAME stoping ..." | |
kill $PID; | |
echo "$NAME stopped ..." | |
rm $PIDFILE | |
else | |
echo "$NAME is not running ..." | |
fi | |
;; | |
restart) | |
if [ -f $PIDFILE ]; then | |
PID=$(cat $PIDFILE); | |
echo "$NAME stopping ..."; | |
kill $PID; | |
echo "$NAME stopped ..."; | |
rm $PIDFILE | |
echo "$NAME starting ..." | |
cd $BASE | |
nohup java -Xmx4G -jar $JAR --server --port 9090 --securePort 9091 --basePath $BASE --graphs graphs --router portugal --autoReload --analyst --insecure 2>> /dev/null >> /dev/null & | |
echo $! > $PIDFILE | |
echo "$NAME started ..." | |
else | |
echo "$NAME is not running ..." | |
fi | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment