Bug#362281: Stop now

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue May 30 00:39:57 UTC 2006


On Tue, May 30, 2006 at 01:17:54AM +0200, Johan Thelmén wrote:
> 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 "$@")

Right.

> 
> 
> 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?

Because I don't know safe_asterisk well enough and don't know where it
can break. Specifically I'm afraid of catching it in the middle of the
asterisk process being temporarily down but restarting.

I don't use safe_asterisk. I think it is a badly written hack (e.g:
daemonizes but lives in /tmp . Thus will not allow you to umount /tmp)
that only serves to hide a problem. If asterisk crashes you should trace
the problem and solve it. You should also fix it. 

> 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.. 

As I said, I don't use safe_asterisk. Just setting it up and replicating
the problem would take much more time than just posting a quick fix.

I did not add anyting to the package. I just asked you to test it.

-- 
Tzafrir Cohen      sip:tzafrir at local.xorcom.com
icq#16849755       iax:tzafrir at local.xorcom.com
+972-50-7952406           
tzafrir.cohen at xorcom.com  http://www.xorcom.com



More information about the Pkg-voip-maintainers mailing list