-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp24server.init.d
66 lines (57 loc) · 2.19 KB
/
p24server.init.d
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
#!/bin/sh
#
# chkconfig: 2405 32 12
# description: Starts and stops p24server
#
# pidfile: /var/run/p24server.pid
#
# remade by Henrietta
# Avoid using root's TMPDIR
unset TMPDIR
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
RETVAL=0
start() {
if [ -f /var/run/p24server.pid ] ; then
echo "p24server already started" && exit 0
fi
echo -n $"Starting p24server: "
/usr/local/bin/p24server/p24server.py
echo
RETVAL=$?
/sbin/pidof p24server.py > /var/run/p24server.pid
}
stop() {
if [ -f /var/run/p24server.pid ] ; then
echo -n $"Stopping p24server: "
killall p24server.py
daemon /usr/local/bin/p24server/cleanup.py
echo
RETVAL=$?
rm -f /var/run/p24server.pid
else
echo "p24server is not running" && exit 0
fi
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?