[Pkg-voip-commits] r10622 - in /stunserver/trunk/debian: stuntman-server.default stuntman-server.init
kilian at alioth.debian.org
kilian at alioth.debian.org
Mon Dec 22 00:09:55 UTC 2014
Author: kilian
Date: Mon Dec 22 00:09:55 2014
New Revision: 10622
URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=10622
Log:
fix init script
Modified:
stunserver/trunk/debian/stuntman-server.default
stunserver/trunk/debian/stuntman-server.init
Modified: stunserver/trunk/debian/stuntman-server.default
URL: http://svn.debian.org/wsvn/pkg-voip/stunserver/trunk/debian/stuntman-server.default?rev=10622&op=diff
==============================================================================
--- stunserver/trunk/debian/stuntman-server.default (original)
+++ stunserver/trunk/debian/stuntman-server.default Mon Dec 22 00:09:55 2014
@@ -3,16 +3,18 @@
# This is a POSIX shell fragment
#
-#uncommment the next line to allow the init.d script to start the stun daemon
+#uncommment the next line to allow the init.d script to start the STUN daemon
#START_DAEMON=true
-# Additional options that are passed to the Daemon.
+MODE="basic"
+#PRIMARY_INTERFACE=""
+#SECONDARY_INTERFACE=""
+#PRIMARY_PORT=3478
+#SECONDARY_PORT=3479
+
+# Additional options that are passed to the daemon
DAEMON_OPTS=""
-
-PRIMARY_IP=""
-SECONDARY_IP=""
-PRIMARY_PORT=3478
-SECONDARY_PORT=3479
+# --maxconn MAXCONN
# whom the daemons should run as
DAEMON_USER=nobody
Modified: stunserver/trunk/debian/stuntman-server.init
URL: http://svn.debian.org/wsvn/pkg-voip/stunserver/trunk/debian/stuntman-server.init?rev=10622&op=diff
==============================================================================
--- stunserver/trunk/debian/stuntman-server.init (original)
+++ stunserver/trunk/debian/stuntman-server.init Mon Dec 22 00:09:55 2014
@@ -24,47 +24,42 @@
# Include stun defaults if available
if [ -f /etc/default/stuntman-server ] ; then
- . /etc/default/stutman-servern
+ . /etc/default/stuntman-server
fi
if [ "$START_DAEMON" != "true" ] ; then
exit 0
fi
-if [ -z $PRIMARY_PORT ];then
- echo "No primary port given. Using default."
- PRIMARY_PORT=3478
+
+ARGS=""
+if [ -z "$MODE" ];then
+ echo "No mode given. Using basic"
+ MODE=basic
fi
-if [ -z $SECONDARY_PORT ];then
- echo "No secondary port given. Using default."
- SECONDARY_PORT=3479
-fi
-if [ -z $DAEMON_USER ];then
+[ -z "$MODE" ]||ARGS="$ARGS --mode $MODE"
+[ -z "$PRIMARY_INTERFACE" ]||ARGS="$ARGS --primaryinterface $PRIMARY_INTERFACE"
+[ -z "$SECONDARY_INTERFACE" ]||ARGS="$ARGS --altinterface $SECONDARY_INTERFACE"
+[ -z "$PRIMARY_PORT" ]||ARGS="$ARGS --primaryport $PRIMARY_PORT"
+[ -z "$SECONDARY_PORT" ]||ARGS="$ARGS --altport $SECONDARY_PORT"
+if [ -z "$DAEMON_USER" ];then
DAEMON_USER=nobody
fi
-DAEMON_OPTS="$DAEMON_OPTS -h $PRIMARY_IP -a $SECONDARY_IP -p $PRIMARY_PORT -o $SECONDARY_PORT"
+DAEMON_OPTS="$ARGS $DAEMON_OPTS "
set -e
case "$1" in
start)
- if [ -z $PRIMARY_IP ];then
- echo "No primary IP given. Exiting."
- exit 1
- fi
- if [ -z $SECONDARY_IP ];then
- echo "No secondary IP given. Exiting."
- exit 1
- fi
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --background --make-pidfile \
- --pidfile $PIDFILE \
- --chuid $DAEMON_USER --exec $DAEMON -- $DAEMON_OPTS
+ --pidfile "$PIDFILE" \
+ --chuid "$DAEMON_USER" --exec "$DAEMON" -- $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
- start-stop-daemon --stop --quiet --pidfile $PIDFILE \
- --oknodo --chuid $DAEMON_USER --exec $DAEMON
+ start-stop-daemon --stop --quiet --pidfile "$PIDFILE" \
+ --oknodo --chuid "$DAEMON_USER" --exec "$DAEMON"
echo "$NAME."
;;
#reload)
@@ -80,25 +75,15 @@
# $PIDFILE --exec $DAEMON
#;;
restart|force-reload)
- if [ -z $PRIMARY_IP ];then
- echo "No primary IP given. Exiting."
- exit 1
- fi
- if [ -z $SECONDARY_IP ];then
- echo "No secondary IP given. Exiting."
- exit 1
- fi
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
echo -n "Restarting $DESC: "
- start-stop-daemon --stop --quiet --pidfile \
- $PIDFILE --exec $DAEMON
+ $0 stop
sleep 1
- start-stop-daemon --start --quiet --pidfile \
- $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
+ $0 start
echo "$NAME."
;;
status)
@@ -118,7 +103,7 @@
fi
;;
*)
- N=/etc/init.d/$NAME
+ N="/etc/init.d/$NAME"
# echo "Usage: $N {start|stop|restart|status|reload|force-reload}" >&2
echo "Usage: $N {start|stop|restart|status|force-reload}" >&2
exit 1
More information about the Pkg-voip-commits
mailing list