[Asterisk-Users] Check and restart script..

Scott Stingel scott at evtmedia.com
Wed Sep 24 08:28:56 MST 2003


Something like this can tell if asterisk is running.  You can modify it as
needed.  Doesn't match the "ps":

if [ "A`ps -e | grep asterisk | grep -v grep`" = "A" ]; then
echo
echo "It's not running"
echo
else
echo
echo "It's running"
echo
fi


Scott M. Stingel 
Emerging Voice Technology Inc.

Email:          scott at evtmedia.com <mailto:scott at evtmedia.com>   
URL:            www.evtmedia.com <http://www.evtmedia.com>   



> -----Original Message-----
> From: asterisk-users-admin at lists.digium.com 
> [mailto:asterisk-users-admin at lists.digium.com] On Behalf Of WipeOut .
> Sent: Wednesday, September 24, 2003 4:02 PM
> To: asterisk-users at lists.digium.com
> Subject: [Asterisk-Users] Check and restart script..
> 
> 
> Has anyone written a script that can be used as a cron job or 
> similar that will test if Asterisk is running and if not restart it??
> 
> I have just had an issue where asterisk crashed and someone 
> was trying to call me.. it would be nice if it could have 
> been automatically restarted..
> 
> I was thinking of a simple bash script something like running 
> "ps -aux |grep asterisk" and then some kind of "if" to say 
> that if the result is nothing then execute asterisk.. Problem 
> with that theory is that the "ps" command will show up as 
> well so i will have to work out a way to drop that..
> 
> Of course I may be missing a simpler or far better solution 
> so thats why I am asking here first..
> 
> Later..
> -- 
> ______________________________________________
> http://www.linuxmail.org/
> Now with e-mail forwarding for only US$5.95/yr
> 
> Powered by Outblaze
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> 
> 




More information about the asterisk-users mailing list