aboutsummaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorcvsz <admin@cvs.in.th>2016-11-16 03:35:30 +0700
committerGitHub <noreply@github.com>2016-11-16 03:35:30 +0700
commit8a44212314ccf5c9ede445e79f5ef6ceb39684a6 (patch)
treed8b0fc0631dfe0452ab358945a58eb9df30c28c4 /setup
parent2b0a470a10e6b8277365da535da1a9c7ce8fefce (diff)
downloadtrackermap-server-8a44212314ccf5c9ede445e79f5ef6ceb39684a6.tar.gz
trackermap-server-8a44212314ccf5c9ede445e79f5ef6ceb39684a6.tar.bz2
trackermap-server-8a44212314ccf5c9ede445e79f5ef6ceb39684a6.zip
Add Service traccar server for package_universal
Diffstat (limited to 'setup')
-rw-r--r--setup/traccar.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/setup/traccar.sh b/setup/traccar.sh
new file mode 100644
index 000000000..d0f195beb
--- /dev/null
+++ b/setup/traccar.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+#service traccar server for universal version
+#eg. ./traccar.sh start
+#eg. ./traccar.sh stop
+#eg. ./traccar.sh restart
+
+SERVICE_NAME=traccar
+PATH_TO_JAR=tracker-server.jar
+PATH_TO_CONF=conf/traccar.xml
+PID_PATH_NAME=/tmp/traccar-pid
+case $1 in
+ start)
+ echo "Starting $SERVICE_NAME ..."
+ if [ ! -f $PID_PATH_NAME ]; then
+ nohup java -jar $PATH_TO_JAR $PATH_TO_CONF /tmp 2>> /dev/null >> /dev/null &
+ echo $! > $PID_PATH_NAME
+ echo "$SERVICE_NAME started ..."
+ else
+ echo "$SERVICE_NAME is already running ..."
+ 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 $PATH_TO_CONF /tmp 2>> /dev/null >> /dev/null &
+ echo $! > $PID_PATH_NAME
+ echo "$SERVICE_NAME started ..."
+ else
+ echo "$SERVICE_NAME is not running ..."
+ fi
+ ;;
+esac