3
# Provides: crtmpserver
4
# Required-Start: $network $local_fs $remote_fs
5
# Required-Stop: $remote_fs
6
# Default-Start: 2 3 4 5
8
# Short-Description: C++ RTMP/RTSP streaming server
9
# Description: High performance RTMP/RTSP/MPEG-TS streaming server
12
# Author: Andriy Beregovenko <jet@jet.kiev.ua>
14
PATH=/sbin:/usr/sbin:/bin:/usr/bin
15
DESC="C++ RTMP Server"
17
DAEMON=/usr/sbin/crtmpserver
18
DAEMON_ARGS=" --daemon "
19
DAEMON_CONF="/etc/crtmpserver/crtmpserver.lua"
21
PIDFILE=/var/run/$NAME.pid
22
SCRIPTNAME=/etc/init.d/$NAME
25
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
27
[ -x $DAEMON ] || exit 0
28
[ -r $DAEMON_CONF ] || exit 0
30
[ $ENABLED = "yes" ] || exit 0
33
. /lib/lsb/init-functions
35
DAEMON_UID=$(getent passwd ${DAEMON_USER} | cut -d":" -f3)
36
if [ -z "${DAEMON_UID}" ]; then
37
echo "Error: User ${DAEMON_USER} does not exist."
41
UID_ARG=" --uid=${DAEMON_UID} "
45
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
47
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
48
$DAEMON_ARGS $UID_ARG $DAEMON_CONF \
54
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
56
[ "$RETVAL" = 2 ] && return 2
58
start-stop-daemon --stop --quiet --oknodo --retry=INT/30/KILL/5 --exec $DAEMON
59
[ "$?" = 2 ] && return 2
67
log_daemon_msg "Starting $DESC " "$NAME"
75
log_daemon_msg "Stopping $DESC" "$NAME"
83
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
86
log_daemon_msg "Restarting $DESC" "$NAME"
93
1) log_end_msg 1 ;; # Old process is still running
94
*) log_end_msg 1 ;; # Failed to start
107
echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2