Refs
Http://stackoverflow.com/questions/11203483/run-a-java-application-as-a-service-on-linux
#!/bin/sh Service_name=myservice Path_to_jar=/usr/local/myproject/myjar.jar pid_path_name=/tmp/myservice-pid Case $ 1 in Start) echo "Starting $SERVICE _name ..." if [! -F $PID _path_name]; Then Nohup java-jar $PATH _to_jar/tmp 2>>/dev/null >>/dev/null & EC Ho $! > $PID _path_name echo "$SERVICE _name started ..." Else echo "$SERVICE _name is already r
Unning ... "FI;; Stop) if [-f $PID _path_name];
Then pid=$ (cat $PID _path_name);
echo "$SERVICE _name stoping ..." Kill $PID; echo "$SERVICE _name stopped ..." rm $PID _path_name Else echo $SERVICE _name is not running
... "FI;; restart) If [-f $PID _path_name];
Then pid=$ (cat $PID _path_name);
echo "$SERVICE _name stopping ...";
Kill $PID; echo "$SERVICE _name stopPed ... "; RM $PID _path_name echo "$SERVICE _name starting ..." Nohup Java-jar $PATH _to_jar/tmp 2>>/d Ev/null >>/dev/null & Echo $! > $PID _path_name echo "$SERVICE _name started ..." Else echo "$SERVICE _name is not Runni
ng ... "fi;; Esac