Package: asterisk / 1:1.6.2.9-2+squeeze12

safe_asterisk-nobg Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Subject: Add an option to safe_asterisk so that it won't background.
Author: Faidon Liambotis <paravoid@debian.org>
Bug-Debian: http://bugs.debian.org/376514
Forwarded: not-needed
Last-Update: 2009-12-19

This is intended to work with start-stop-daemon's --background option which
results in a correct pidfile since the process doesn't fork.

Needs more work from me to not change behavior for users but only for the
init script. After that, it can safely go upstream.

--- a/contrib/scripts/safe_asterisk
+++ b/contrib/scripts/safe_asterisk
@@ -14,6 +14,7 @@ SLEEPSECS=4
 ASTSBINDIR=__ASTERISK_SBIN_DIR__
 ASTVARRUNDIR=__ASTERISK_VARRUN_DIR__
 ASTPIDFILE=${ASTVARRUNDIR}/asterisk.pid
+BACKGROUND=0
 
 # comment this line out to have this script _not_ kill all mpg123 processes when
 # asterisk exits
@@ -197,4 +198,8 @@ run_asterisk()
 	done
 }
 
-run_asterisk &
+if [ "$BACKGROUND" = "1" ]; then
+	run_asterisk &
+else
+	run_asterisk
+fi