forked from sipwise/rtpengine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtpengine-recording.init
91 lines (82 loc) · 1.83 KB
/
rtpengine-recording.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
91
#!/bin/bash
#
# rtpengine-recording Startup script for NGCP rtpengine-recording
#
# chkconfig: 345 84 16
# description: NGCP rtpengine-recording
#
# processname: rtpengine-recording
# config: /etc/sysconfig/rtpengine-recording
# pidfile: /run/rtpengine-recording.pid
#
### BEGIN INIT INFO
# Provides: rtpengine
# Required-Start: $local_fs $network
# Short-Description: NGCP rtpengine-recording
# Description: NGCP rtpengine-recording
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/rtpengine-recording ]
then
. /etc/sysconfig/rtpengine-recording
else
echo "Error: /etc/sysconfig/rtpengine-recording not present" >&2
exit 6
fi
prog=rtpengine-recording
runfile=/usr/bin/${prog}
pidfile=${PIDFILE-/run/rtpengine-recording.pid}
lockfile=${LOCKFILE-/var/lock/subsys/rtpengine-recording}
RETVAL=0
OPTS=""
[ -z "$CONFIG_FILE" ] || OPTS+=" --config-file=$CONFIG_FILE"
[ -z "$PIDFILE" ] || OPTS+=" --pidfile=$PIDFILE"
start() {
echo -n $"Starting $prog: "
if [[ -n "$RE_USER" ]]
then
# shellcheck disable=SC2086
daemon --user "$RE_USER" --pidfile="${pidfile}" "$runfile" $OPTS
else
# shellcheck disable=SC2086
daemon --pidfile="${pidfile}" "$runfile" $OPTS
fi
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch "${lockfile}"
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p "${pidfile}" "$runfile"
RETVAL=$?
[ $RETVAL = 0 ] && rm -f "${lockfile}" "${pidfile}"
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p "${pidfile}" "$runfile"
RETVAL=$?
;;
restart)
stop
start
;;
condrestart|try-restart)
if status -p "${pidfile}" "$runfile" >&/dev/null; then
stop
start
fi
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|status}"
RETVAL=2
esac
exit $RETVAL