Skip to content
Commits on Source (2)
......@@ -118,6 +118,10 @@ status() {
status_of_proc -p "$PIDFILE" "$NAME" "$DESC" && return 0 || return $?
}
safe_status() {
status_of_proc -p "$ASTSAFE_PIDFILE" "$NAME" "$DESC" && return 0 || return $?
}
asterisk_rx() {
if ! status >/dev/null; then return 0; fi
......@@ -139,46 +143,53 @@ case "$1" in
exit 0
;;
start)
if status > /dev/null; then
if [ "$RUNASTSAFE" = "yes" ];then
if safe_status >/dev/null; then
echo "$DESC is already running. Use restart."
exit 0
fi
echo -n "Starting $DESC: "
if [ "$RUNASTSAFE" != "yes" ];then
# TODO: what if we cought the wrapper just as its asterisk
# was killed? status should check for the wrapper if we're in
# "safe mode"
export ASTSAFE_FOREGROUND=1
start-stop-daemon --start --group $GROUP \
--background --make-pidfile \
$CHDIR_PARM --pidfile "$ASTSAFE_PIDFILE" \
--exec $REALDAEMON -- $PARAMS
else
if status >/dev/null; then
echo "$DESC is already running. Use restart."
exit 0
fi
echo -n "Starting $DESC: "
start-stop-daemon --start --group $GROUP --pidfile "$PIDFILE" \
$CHDIR_PARM \
--exec $REALDAEMON -- $PARAMS > /dev/null
else
export ASTSAFE_FOREGROUND=1
start-stop-daemon --start --group $GROUP \
--background --make-pidfile \
$CHDIR_PARM --pidfile "$ASTSAFE_PIDFILE" \
--exec $REALDAEMON -- $PARAMS
fi
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: $NAME"
# Try gracefully.
# this may hang in some cases. Specifically, when the asterisk
# This may hang in some cases. Specifically, when the asterisk
# processes is stopped. No bother to worry about cleanup:
# it will either fail or die when asterisk dies.
( asterisk_rx 'core stop now' > /dev/null 2>&1 & ) &
if [ "$RUNASTSAFE" = "yes" ];then
# If you're switching back and forth between RUNASTSAFE
# you may get a warning about a stale pidfile. Ignore
# it.
start-stop-daemon --stop --quiet --oknodo \
--pidfile $ASTSAFE_PIDFILE
rm -f $ASTSAFE_PIDFILE
fi
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON --pidfile=$PIDFILE
# Sometimes during a quick restart cycle, the 'core stop now'
# from above won't reach the daemon -- perhaps it wasn't
# listening yet. At this point we want TERM to kick in.
# In any case, we must be certain that it is stopped before we
# exit the "stop" case; otherwise a "restart" might complete
# with no asterisk running at all (because of the status checks
# in "start").
start-stop-daemon --stop --quiet --oknodo --retry=8/TERM/30/KILL/5 \
--exec $DAEMON --pidfile=$PIDFILE
echo "."
;;
reload)
......
asterisk (1:16.1.0~dfsg-4) experimental; urgency=medium
* Update build-deps
- Revert mariadb-10.3 change, not necessary anymore
- Add libsnmp-dev again, works now
- Add libosptk-dev for Open Settlement Protocol, see Bug#786973.
Not sure yet whether we will keep this for unstable.
- Drop libsqlite0-dev, deprecated
* Do not load any local channel drivers by default (see #821392)
* asterisk.service: Attempt to run with realtime priority by default
(see #801629)
* Improve/fix some race-conditions in sysv-initscript.
Thanks to Walter Doekes (see #778746)
-- Bernhard Schmidt <berni@debian.org> Fri, 04 Jan 2019 16:00:17 +0100
asterisk (1:16.1.0~dfsg-3) experimental; urgency=medium
* Adjust MySQL build-dep for current mariadb-10.3 breakage
......