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 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10114 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
65c91197b9
commit
2f9c3e9f1f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue