[Asterisk-Users] stop asterisk when Idle

asterisk at frameweb.it asterisk at frameweb.it
Mon Nov 28 06:36:00 MST 2005


Thank you for your asnswer

I found that between 7 and 8 in the mornig I have a low load of my box.

I modify my script in this way:

asterisk02:/ # cat /closeasteriskandreboot.sh
#!/bin/bash
echo chiusura schedulata "when convenient" di asterisk
/usr/sbin/asterisk -rx "stop when convenient"

mypid=$(pidof asterisk)
echo "mypid=${mypid}"

while [ "${mypid}empty" != "empty" ] ; do
  echo "Il pid di asterisk esiste ancora ( = ${mypid} ) , aspetto altri 10
secondi"
# adesso dormo per dieci secondi per aspettare che asterisk chiuda tutto
bene
  sleep 10
  mypid=$(pidof asterisk)
  echo "mypid=${mypid}"
done

echo "Il pid di asterisk non esiste piu' , riavvio il pc"
echo reboot del server, ciao ciao
/sbin/reboot

exit

***************************
I think that it should be possible to reach a "convenient" (idle) time.
I could also implement a sort of "timeout" (if in half an hour asterisk is
still up, then send stop now command and then reboot)...

On the other side, I didn'i install any monitoring utility on my box (I
don't konw them) The bigger problem is that it is a productivity box, and
to do a lot of experiments is not so easy....

So I think that I will leave my box as it is now, and I will check in the
future if this strange oh323 problem will be found elsewhere and resolved.

thanks all,

Andrea



                                                                           
             "Leif Neland"                                                 
             <leifn at neland.dk>                                             
             Sent by:                                                   To 
             asterisk-users-bo         "Asterisk Users Mailing List -      
             unces at lists.digiu         Non-Commercial Discussion"          
             m.com                     <asterisk-users at lists.digium.com>   
                                                                        cc 
                                                                           
             26/11/2005 17.35                                      Subject 
                                       Re: [Asterisk-Users] stop asterisk  
                                       when Idle                           
             Please respond to                                             
              Asterisk Users                                               
              Mailing List -                                               
              Non-Commercial                                               
                Discussion                                                 
             <asterisk-users at l                                             
             ists.digium.com>                                              
                                                                           
                                                                           




>> I still continue to reboot my asterisk box everyday.
>>
>> I posted a message on November 22, but it was on another thread and
>> no one answered me, so I try again here,
>> where a lot of people told be I was a bad administrator ("Like a
>> Windows administrator" and I don'0t want to resolve my problem)
>>
>> Actually I would like to resolve my problem, but I am not able to do
>> this, so I ask help to anybody who can help me, and repost my
>> last of 22/11/2005
>>
>> In short, my problem is that, after one or two days of running, chan
>> oh323 suddendly disappear from asterisk box, without giving any
>> warning / error In example, you type oh323 show stats at 11 o'clock
>> , and get an answer from asterisk, about usage of oh323
>>
>> At 12, without doing anything to the box or to the asterisk, you
>> type the same command, and you get a  "No such command 'oh323' (type
>> 'help' for help)
>>
>> If you type help, no oh323 commands are available.
>> If you quit asterisk, (STOP NOW) and restart asterisk , no oh323
>> channel command is available
>>
>> if you reboot the machine everything is again fine !
>>
>> It is so a crazy situation that to reboot appears (to me) the
>> best thing (I
>> am sorry about this)

If you really need to have oh323, then you should test say every 5 minutes
or so, and then shutdown asterisk and reboot.

if asterisk -r -x "oh323"|grep help
then
  echo "oh323 missing"|mail administrator
  asterisk -r -x "stop now"
  reboot
fi

Ii is better to disconnect the existing users if they can not use the box
without oh323

Do you have some kind of monitoring running? Like Big Brother or nagios?
It might be interesting to see when oh323 dies.
Perhaps you could also use mrtg to graph usage levels to see if there is
some kind of correlation between usage and oh323 fatality

Leif

_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users





More information about the asterisk-users mailing list