[SCM] crtmpserver/master: Add example basic configuration and init script

jet-guest at users.alioth.debian.org jet-guest at users.alioth.debian.org
Fri Apr 29 23:18:39 UTC 2011


The following commit has been merged in the master branch:
commit d73cc0dae5bb813055a00cfef8d585dbc7f64a2f
Author: Andriy Beregovenko <jet at jet.kiev.ua>
Date:   Sat Apr 30 02:16:29 2011 +0300

    Add example basic configuration and init script

diff --git a/debian/crtmpserver.examples b/debian/crtmpserver.examples
new file mode 100644
index 0000000..78db861
--- /dev/null
+++ b/debian/crtmpserver.examples
@@ -0,0 +1,2 @@
+debian/examples/*
+crtmpserver/crtmpserver.lua
diff --git a/debian/examples/crtmpserver.default b/debian/examples/crtmpserver.default
new file mode 100644
index 0000000..33e30f9
--- /dev/null
+++ b/debian/examples/crtmpserver.default
@@ -0,0 +1,8 @@
+# Defaults for rtmpd initscript
+# sourced by /etc/init.d/rtmpd
+
+# Additional options that are passed to the Daemon.
+ENABLED=yes
+DAEMON_CONF=" /etc/crtmpserver/crtmpserver.lua "
+DAEMON_OPTS=" --daemon "
+DAEMON_USER=crtmpserver
diff --git a/debian/examples/crtmpserver.init b/debian/examples/crtmpserver.init
new file mode 100644
index 0000000..7d86bfe
--- /dev/null
+++ b/debian/examples/crtmpserver.init
@@ -0,0 +1,104 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          crtmpserver
+# Required-Start:    $network $local_fs $remote_fs
+# Required-Stop:     $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: C++ RTMP/RTSP streaming server
+# Description:       High performance RTMP/RTSP/MPEG-TS streaming server
+### END INIT INFO
+
+# Author: Andriy Beregovenko <jet at jet.kiev.ua>
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="C++ RTMP Server"
+NAME=crtmpserver
+DAEMON=/usr/sbin/crtmpserver
+DAEMON_ARGS=" --daemon "
+DAEMON_CONF="/etc/crtmpserver/crtmpserver.lua"
+DAEMON_USER=crtmpserver
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+ENABLED=no
+
+[ -x $DAEMON ] || exit 0
+
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+. /lib/init/vars.sh
+. /lib/lsb/init-functions
+
+UID=$(getent passwd ${DAEMON_USER} | cut -d":" -f3)
+UID_ARG=" --uid=$UID "
+
+do_start()
+{
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+		|| return 1
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+		$DAEMON_ARGS $UID_ARG $DAEMON_CONF \
+		|| return 2
+}
+
+do_stop()
+{
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+	RETVAL="$?"
+	[ "$RETVAL" = 2 ] && return 2
+
+	start-stop-daemon --stop --quiet --oknodo --retry=INT/30/KILL/5 --exec $DAEMON
+	[ "$?" = 2 ] && return 2
+
+	rm -f $PIDFILE
+	return "$RETVAL"
+}
+
+case "$1" in
+  start)
+    log_daemon_msg "Starting $DESC " "$NAME"
+    do_start
+    case "$?" in
+		0|1) log_end_msg 0 ;;
+		2) log_end_msg 1 ;;
+	esac
+  ;;
+  stop)
+	log_daemon_msg "Stopping $DESC" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) log_end_msg 0 ;;
+		2) log_end_msg 1 ;;
+	esac
+	;;
+  status)
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
+  restart)
+	log_daemon_msg "Restarting $DESC" "$NAME"
+	do_stop
+	case "$?" in
+	  0|1)
+		do_start
+		case "$?" in
+			0) log_end_msg 0 ;;
+			1) log_end_msg 1 ;; # Old process is still running
+			*) log_end_msg 1 ;; # Failed to start
+		esac
+		;;
+	  *)
+	  	# Failed to stop
+		log_end_msg 1
+		;;
+	esac
+	;;
+  force-reload)
+	restart
+	;;
+  *)
+	echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
+	exit 3
+	;;
+esac
+
+:

-- 
crtmpserver packaging



More information about the pkg-multimedia-commits mailing list