-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathcomet-service.sh
executable file
·53 lines (48 loc) · 1.25 KB
/
comet-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
49
50
51
52
53
#!/bin/bash
echo "CppComet"
PATH=/sbin:/usr/sbin:/bin:/usr/bin
RUNDIR=/usr/bin
EXTRAOPTS=
PIDFILE=/var/run/cppcomet.pid
cd ${RUNDIR}
case "$1" in
start)
if test -f "$PIDFILE"
then
echo "CppComet already run"
else
echo "Starting CppComet"
ulimit -n 100000
/usr/bin/cppcomet --conf /etc/comet-server/comet.ini > /var/log/cpp_comet.log 2>/var/log/cpp_comet.log &
fi
;;
stop)
if test -f "$PIDFILE"
then
echo "Stopping CppComet"
killall cppcomet
kill `cat $PIDFILE`
`rm -rf $PIDFILE`
else
echo "Stopping CppComet"
killall cppcomet
#echo "pid file does not exist"
#echo 'exit' > /tmp/cpp.comet
fi
;;
*)
if test -f "$PIDFILE"
then
echo "Stopping CppComet"
killall -9 cppcomet
kill `cat $PIDFILE`
`rm -rf $PIDFILE`
else
echo "pid file does not exist"
fi
echo "Starting CppComet"
sleep 15
ulimit -n 100000
/usr/bin/cppcomet --conf /etc/comet-server/comet.ini > /var/log/cpp_comet.log 2>/var/log/cpp_comet.log &
;;
esac