]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make freeswitch stop graceflly with /etc/init.d/freeswitch stop on debian
authorMichal Bielicki <michal.bielicki@seventhsignal.de>
Wed, 22 Oct 2008 18:14:58 +0000 (18:14 +0000)
committerMichal Bielicki <michal.bielicki@seventhsignal.de>
Wed, 22 Oct 2008 18:14:58 +0000 (18:14 +0000)
add working dir to start-stop-dir so freeswitch dumps core in workdir

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10114 d0543943-73ff-0310-b7d9-9358b9ac24b2

debian/freeswitch.init

index 556e4800cb46e365c89e8e1e7441b616cf432a1e..b7a294f94405adb1a3f548d02c0f69d0bbcdaab6 100755 (executable)
@@ -22,6 +22,7 @@ DAEMON=/opt/freeswitch/bin/$NAME
 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 @@ fi
 
 # 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 @@ do_start()
        #   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 @@ do_stop()
        #   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 @@ do_stop()
        # 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