[asterisk-dev] [Code Review] 3574: safe_asterisk: Cleanup and debian compatibility.
wdoekes
reviewboard at asterisk.org
Tue Jun 3 05:49:39 CDT 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3574/
-----------------------------------------------------------
(Updated June 3, 2014, 10:49 a.m.)
Review request for Asterisk Developers and Tzafrir Cohen.
Changes
-------
10:17 <@tzafrir_laptop> One minor nit (for a later commit) - the configure syntax of 'test x$foo != x'
So:
- removed the ugly configure syntax in favor of (mostly) test -n and test -z and test "$x" = "y".
- removed excess $ from $((variable+1)) calculation
- added extra double quotes to tackle the unlikely case that someone is using spaces in directories.
Bugs: ASTERISK-23492
https://issues.asterisk.org/jira/browse/ASTERISK-23492
Repository: Asterisk
Description
-------
A couple of fixes to safe_asterisk.
In order of appearance:
* Drop the vim #modeline. It isn't used consistently (textwidth was exceeded)
and anyone who setting tabspace to something other than 8 should be frowned upon.
(If you want 4 spaces, use expandtab (et) and friends (sts, sw).
* The message() function outputted messages to the terminal where the process
was initially started: that means that if you start it on terminal A, you kill it
on B, you get a message about killing it on A again.
Rewritten to output it to /dev/$TTY if that was set and suppressed otherwise.
* For compatibility with debian users who have been living with this:
https://github.com/leifmadsen/asterisk/blob/master/debian/patches/safe_asterisk-config
we allow TTY to be empty or 'no'.
* Consistent spacing: no space before ; and no space after the redirection operators.
No blobs. Only tabs for indentation.
* If TTY is no (or empty), then redirect all output to /dev/null. This was a daemon
process, remember?
* Add option to export ASTSAFE_FOREGROUND=1 from the init script that call this. This
is for compatibility with this:
https://github.com/leifmadsen/asterisk/blob/master/debian/patches/safe_asterisk-nobg
Of course that will require a change to this:
https://github.com/leifmadsen/asterisk/blob/master/debian/asterisk.init
but that's beyond the scope of asterisk.
(This is what ticket ASTERISK-23492 is about.)
Diffs (updated)
-----
/branches/1.8/contrib/scripts/safe_asterisk 415051
Diff: https://reviewboard.asterisk.org/r/3574/diff/
Testing
-------
I tested TTY=, TTY=no, TTY=9 and tested whether doing this on the asterisk.init script worked:
--- init.orig 2014-05-29 16:54:05.755379751 +0200
+++ /etc/init.d/asterisk 2014-05-29 16:42:20.622731338 +0200
@@ -151,11 +151,11 @@ case "$1" in
echo "$DESC is already running. Use restart."
exit 0
fi
- export SAFE_AST_BACKGROUND=1
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" \
All changes should be backwards compatible, except for the people who expect crap on the
terminal they used to start safe_asterisk on.
I wanted to change the daemonization to make it fully detached (double fork), but that
would probably mess with someones (upstart?) fork-count expectations. So I left that
alone.
Thanks,
wdoekes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140603/6503f8be/attachment-0001.html>
More information about the asterisk-dev
mailing list