-
Notifications
You must be signed in to change notification settings - Fork 124
/
service.sh
executable file
·48 lines (43 loc) · 1.14 KB
/
service.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
#!/bin/bash
BASEDIR="/usr/local/stathub"
PIDFILE="log/stathub.pid"
cd $BASEDIR
start() {
echo "starting"
if [ ! -f $PIDFILE ]; then
./stathub -c conf/stathub.conf
echo "ok"
echo "----------------------------------------------------"
echo "| Please open the below URL on your PC browser: |"
echo "| https://this-server-ip:15944 |"
echo "| Default password: likexian |"
echo "| |"
echo "| Feedback: https://github.com/likexian/stathub-go |"
echo "| Thank you for your using, By Li Kexian |"
echo "| StatHub, Apache License, Version 2.0 |"
echo "----------------------------------------------------"
fi
}
stop() {
echo "stopping"
if [ -f $PIDFILE ]; then
kill -9 `cat $PIDFILE`
rm -rf $PIDFILE
echo "ok"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac