-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgapp.run.sh
executable file
·67 lines (56 loc) · 1006 Bytes
/
gapp.run.sh
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
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
SERVER="gapp"
CMD_DIR=$PWD
function start()
{
if [ "`pgrep ${SERVER}`" != "" ]
then
echo "${SERVER} already running"
exit 1
fi
nohup ${CMD_DIR}/${SERVER} &>"./var/log/nohup.$SERVER.log" &
if [ "`pgrep ${SERVER}`" == "" ]
then
echo "${SERVER} start failed."
exit 1
fi
}
function stop()
{
if [ "`pgrep ${SERVER} -u ${UID}`" != "" ]
then
kill -9 `pgrep $SERVER -u $UID`
exit 1
fi
if [[ "`pgrep ${SERVER} -u ${UID}`" != "" ]]
then
echo "${SERVER} stop failed"
exit 1
fi
}
function status()
{
if [[ "`pgrep ${SERVER} -u ${UID}`" != "" ]];then
echo "${SERVER} is running"
else
echo ${SERVER} is not running
fi
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
stop && start
;;
'status')
status
;;
*)
echo "usage: $0 {start|stop|restart|status}"
exit 1
;;
esac