forked from kuoruan/kcptun_installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredhat.init
executable file
·90 lines (80 loc) · 2.06 KB
/
redhat.init
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#! /bin/bash
#
# chkconfig: 345 83 04
# description: Supervisor is a client/server system that allows \
# its users to monitor and control a number of processes on \
# UNIX-like operating systems.
# processname: supervisord
# config: /etc/supervisor/supervisord.conf
# pidfile: /var/run/supervisord.pid
#
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $all
# Required-Stop: $all
# Short-Description: start and stop Supervisor process control system
# Description: Supervisor is a client/server system that allows
# its users to monitor and control a number of processes on
# UNIX-like operating systems.
### END INIT INFO
# Source function library
. /etc/rc.d/init.d/functions
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PREFIX=/usr
SUPERVISORD=$PREFIX/bin/supervisord
SUPERVISORCTL=$PREFIX/bin/supervisorctl
NAME=supervisord
PIDFILE=/var/run/supervisord.pid
OPTIONS="-c /etc/supervisor/supervisord.conf"
STOP_TIMEOUT=10
RETVAL=0
test -x $SUPERVISORD || exit 1
do_start() {
if status -p $PIDFILE $SUPERVISORD >&/dev/null; then
echo "$NAME is already running."
RETVAL=0
else
echo -n $"Starting $NAME: "
daemon --pidfile=$PIDFILE $SUPERVISORD $OPTIONS -j $PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && $SUPERVISORCTL $OPTIONS status
fi
}
do_stop() {
if status -p $PIDFILE $SUPERVISORD >&/dev/null; then
echo -n $"Stopping $NAME: "
killproc -p $PIDFILE -d $STOP_TIMEOUT $SUPERVISORD
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -rf $PIDFILE
else
echo "$NAME is not running."
RETVAL=0
fi
}
chk_status() {
status -p $PIDFILE $SUPERVISORD
RETVAL=$?
[ $RETVAL -eq 0 ] && $SUPERVISORCTL $OPTIONS status
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
status)
chk_status
;;
restart)
do_stop
do_start
;;
*)
echo $"Usage: /etc/init.d/$NAME {start|stop|restart|status}"
RETVAL=2
;;
esac
exit $RETVAL