-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestserver
More file actions
executable file
·55 lines (44 loc) · 860 Bytes
/
Copy pathtestserver
File metadata and controls
executable file
·55 lines (44 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
#starts and stops test server
#
USER="user"
SERVICEPATH="/home/$USER/testServerApiApp/testServerApi"
RUNPATH="$SERVICEPATH/target/start"
PIDFILE="$SERVICEPATH/RUNNING_PID"
pidof_service() {
if [ -e "$PIDFILE" ]; then
if ps aux | grep play | tr ' ' '\n' | grep -w $(cat $PIDFILE); then
return 0
fi
fi
return 1
}
case "$1" in
start)
start-stop-daemon --start --exec $RUNPATH -c $USER -d $SERVICEPATH -b --pidfil $PIDFILE
;;
stop)
start-stop-daemon --stop --signal TERM --pidfile $PIDFILE
;;
status)
PID=$(pidof_service) || true
if [ -n "$PID" ]; then
echo "testserver is running (pid $PID)."
exit 0
else
echo "testserver is NOT running."
if [ -e "$PIDFILE" ]; then
exit 1
else
exit 3
fi
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac