[Freeswitch-svn] [commit] r10114 - freeswitch/trunk/debian

Freeswitch SVN cypromis at freeswitch.org
Wed Oct 22 14:14:58 EDT 2008


Author: cypromis
Date: Wed Oct 22 14:14:58 2008
New Revision: 10114

Modified:
   freeswitch/trunk/debian/freeswitch.init

Log:
make freeswitch stop graceflly with /etc/init.d/freeswitch stop on debian
add working dir to start-stop-dir so freeswitch dumps core in workdir



Modified: freeswitch/trunk/debian/freeswitch.init
==============================================================================
--- freeswitch/trunk/debian/freeswitch.init	(original)
+++ freeswitch/trunk/debian/freeswitch.init	Wed Oct 22 14:14:58 2008
@@ -22,6 +22,7 @@
 USER=freeswitch
 PIDFILE=/opt/freeswitch/log/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
+WORKDIR=/opt/$NAME
 
 # Check if we are being executed by init
 
@@ -45,7 +46,7 @@
 
 # Define LSB log_* functions.
 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
-[ -x /lib/init/vars.sh ] && . /lib/lsb/init-functions
+. /lib/lsb/init-functions
 
 #
 # Function that starts the daemon/service
@@ -56,9 +57,9 @@
 	#   0 if daemon has been started
 	#   1 if daemon was already running
 	#   2 if daemon could not be started
-	start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+	start-stop-daemon -d $WORKDIR -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
 		|| return 1
-	start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+	start-stop-daemon -d $WORKDIR -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
 		$FREESWITCH_PARAMS \
 		|| return 2
 	# Add code here, if necessary, that waits for the process to be ready
@@ -76,7 +77,8 @@
 	#   1 if daemon was already stopped
 	#   2 if daemon could not be stopped
 	#   other if a failure occurred
-	start-stop-daemon -c $USER --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+	$DAEMON -stop
+	start-stop-daemon -d $WORKDIR -c $USER --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
 	RETVAL="$?"
 	[ "$RETVAL" = 2 ] && return 2
 	# Wait for children to finish too if this is a daemon that forks
@@ -85,7 +87,7 @@
 	# that waits for the process to drop all resources that could be
 	# needed by services started subsequently.  A last resort is to
 	# sleep for some time.
-	start-stop-daemon -c $USER --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+	start-stop-daemon -d $WORKDIR -c $USER --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
 	[ "$?" = 2 ] && return 2
 	# Many daemons don't delete their pidfiles when they exit.
 	rm -f $PIDFILE



More information about the Freeswitch-svn mailing list