diff options
author | madpilot <madpilot@FreeBSD.org> | 2017-08-22 20:59:53 +0800 |
---|---|---|
committer | madpilot <madpilot@FreeBSD.org> | 2017-08-22 20:59:53 +0800 |
commit | 237c7a74979facf4a6e45fd41c6895c10ba0ad5a (patch) | |
tree | 09593f9ac991717d1f0c612ab9e8c4e1515667b0 /net/asterisk13 | |
parent | 2a4d47bfb21ea69dad77aa91a01a29a4a15c8887 (diff) | |
download | freebsd-ports-gnome-237c7a74979facf4a6e45fd41c6895c10ba0ad5a.tar.gz freebsd-ports-gnome-237c7a74979facf4a6e45fd41c6895c10ba0ad5a.tar.zst freebsd-ports-gnome-237c7a74979facf4a6e45fd41c6895c10ba0ad5a.zip |
Make the provided rc script more robust.
Also add an asterisk_stopsleep knob (disabled by default) to allow
users to work around a possible race condition when asterisk is sent
a stop command just after launching, but before it's startup is
actually completed.
PR: 221271
Submitted by: O. Hartmann <ohartmann@walstatt.org>
MFH: 2017Q3
Diffstat (limited to 'net/asterisk13')
-rw-r--r-- | net/asterisk13/Makefile | 1 | ||||
-rw-r--r-- | net/asterisk13/files/asterisk.in | 20 |
2 files changed, 19 insertions, 2 deletions
diff --git a/net/asterisk13/Makefile b/net/asterisk13/Makefile index 458b90121be9..9ec5365c9b7b 100644 --- a/net/asterisk13/Makefile +++ b/net/asterisk13/Makefile @@ -2,6 +2,7 @@ PORTNAME= asterisk PORTVERSION= 13.17.0 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= http://downloads.asterisk.org/pub/telephony/%SUBDIR%/:DEFAULT,g729 MASTER_SITE_SUBDIR= asterisk/ \ diff --git a/net/asterisk13/files/asterisk.in b/net/asterisk13/files/asterisk.in index e2d997ecc201..54adef50c7e6 100644 --- a/net/asterisk13/files/asterisk.in +++ b/net/asterisk13/files/asterisk.in @@ -17,6 +17,8 @@ # Default is "-n" # asterisk_pidfile (string): Location of the asterisk pid file # Default is /var/run/asterisk/asterisk.pid +# asterisk_stopsleep (int): Number of seconds to sleep before sending stop command +# Default is 0, which disables it # . /etc/rc.subr @@ -31,6 +33,7 @@ load_rc_config $name : ${asterisk_user:=%%ASTERISK_USER%%} : ${asterisk_args=-n} : ${asterisk_pidfile:=/var/run/asterisk/asterisk.pid} +: ${asterisk_stopsleep:=0} extra_commands=reload @@ -52,13 +55,26 @@ asterisk_precmd() asterisk_stop() { - echo 'Stopping asterisk' + if [ -z "$rc_pid" ]; then + [ -n "$rc_fast" ] && return 0 + _run_rc_notrunning + return 1 + fi + echo 'Stopping asterisk.' + if [ ${asterisk_stopsleep} > 0 ]; then + sleep ${asterisk_stopsleep} + fi $command -nqrx 'core stop now' + wait_for_pids $rc_pid } asterisk_reload() { - echo 'Reloading asterisk' + if [ -z "$rc_pid" ]; then + _run_rc_notrunning + return 1 + fi + echo 'Reloading asterisk.' $command -nqrx 'reload' } |