Bug#362281: Stop now

Johan Thelmén jth at home.se
Mon May 29 23:17:54 UTC 2006


Tzafrir Cohen wrote:
> On Mon, May 29, 2006 at 05:44:16PM +0200, Johan Thelmén wrote:
>> 
>> $REALDAEMON is stripping the '  so it only get the command stop
>> 
>> Tried to replace $CLIARGS in safe_asterisk with $* but then it exited
>> with code 1 and restarted and restarted..
>> I probably missed something.
>>
>> /etc/init.d/asterisk
>>   stop)
>>         echo -n "Stopping $DESC: "
>> #       if [ "$RUNASTSAFE" = "yes" ];then
>> #               # hopefully this will work. Untested
>> #               $REALDAEMON -rx 'stop now' > /dev/null  || true
>> #       else
>>                 # Try gracefully.
>>                 # 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.
>>                 ( $DAEMON -rx 'stop now' > /dev/null 2>&1 & ) &
>> #       fi
> 
> Could you please instead try applying the attached patch to safe_asterisk?
> (Basically: replace CLIARGS with a plain "$@")


You know when using the $@ in a function, then it is not the arguments from the program we get..
But we can provide the argument from the program to the function as argument.
run_asterisk "$@" &

+ run_asterisk -rx 'stop now'
+ :
+ '[' tty9 '!=' '' ']'
+ cd /tmp
+ stty sane
+ /usr/sbin/asterisk -rx 'stop now' -vvvg -c
+ echo -n asterisk
asterisk+ '[' yes = yes ']'
+ start-stop-daemon --quiet --oknodo --stop --exec /usr/sbin/safe_asterisk
+ start-stop-daemon --stop --quiet --oknodo --retry=0/2/TERM/2/KILL/5 --exec /usr/sbin/safe_asterisk
+ echo .
.
+ exit 0
fs1-blg:/etc/init.d# + EXITSTATUS=0
+ echo 'Asterisk ended with exit status 0'
Asterisk ended with exit status 0
+ '[' 0 = 0 ']'
+ echo 'Asterisk shutdown normally.'
Asterisk shutdown normally.
+ exit 0

It gets shutdown but.. 

+ EXITSTATUS=141
The shutdown command.. in a loop. 

So why make it so hard and not use the same shutdown as non safe?
See my /etc/init.d/asterisk above
Is there a problem using $DAEMON instead of $REALDAEMON? 
Remember $REALDAEMON is not the realdaemon asterisk but the the safe_wrapper for some strange reason.

Also please try patches before posting and submitting.. 

-- 
Johan Thelmén
Sweden Falun




More information about the Pkg-voip-maintainers mailing list