[Asterisk-Users] Daily Reboot Script for Asterisk Question

Mojo with Horan & Company, LLC mojo at horanappraisals.com
Fri Dec 9 18:15:24 MST 2005


the while loop runs "ps ax" which shows all active processes. the text 
output is piped through grep looking for lines containing 
"[s]afe_asterisk".  Only these lines will be printed by grep. 
Basically, if the while loop gets any textual lines after grep is done, 
it considers the result true and proceeds with sleep 5.  if grepping for 
the text results in no output (asterisk isn't running) then the while 
loop is terminated and asterisk is restarted.  The loop is then began 
again, presumably.

Moj

Min Hwan Chang wrote:
> Currently I'm using the daily reboot script for asterisk and I was
> just wondering what the following line actually does:
> while /bin/ps ax | /bin/grep '[s]afe_asterisk' >/dev/null; do sleep 5; done
> 
> It is from this script which I'm running through crontab:
> /usr/sbin/asterisk -rx "stop when convenient"
> while /bin/ps ax | /bin/grep '[s]afe_asterisk' >/dev/null; do sleep 5; done
> /sbin/rmmod wctdm
> /sbin/modprobe wctdm
> /usr/sbin/safe_asterisk
> 
> Yes I understand that daily reboot is unnecessary but until I find the
> problem, this works for our needs.  I'm wondering what that line does
> because last night when the Cron job started running, it kept running
> the job over and over until I got an out of memory error... as seen
> below:
> 
> /var/log/messages
> Nov  9 04:15:32 localhost kernel: Registered tone zone 0 (United States / North$
> Nov  9 04:18:00 localhost kernel: Freed a Wildcard
> Nov  9 04:18:02 localhost kernel: Freshmaker version: 71
> Nov  9 04:18:02 localhost kernel: Freshmaker passed register test
> Nov  9 04:18:02 localhost kernel: Module 0: Installed -- AUTO FXO (FCC mode)
> Nov  9 04:18:02 localhost kernel: Module 1: Installed -- AUTO FXO (FCC mode)
> Nov  9 04:18:02 localhost kernel: Module 2: Installed -- AUTO FXO (FCC mode)
> Nov  9 04:18:02 localhost kernel: Module 3: Installed -- AUTO FXO (FCC mode)
> Nov  9 04:18:02 localhost kernel: Found a Wildcard TDM: Wildcard TDM400P REV E/$
> Nov  9 04:18:02 localhost kernel: Registered tone zone 0 (United States / North$
> Nov  9 07:07:12 localhost kernel: Out of Memory: Killed process 11022 (sendmail$
> Nov  9 07:08:57 localhost kernel: Out of Memory: Killed process 2722 (sendmail).
> Nov  9 07:09:04 localhost kernel: Out of Memory: Killed process 21792 (sendmail$
> Nov  9 07:09:10 localhost kernel: Out of Memory: Killed process 24036 (sendmail$
> Nov  9 07:11:00 localhost kernel: Out of Memory: Killed proc
> _______________________________________________
> --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
> 

-- 
Mojo <mojo at horanappraisals.com>
Office Manger, Horan & Company, LLC
(907) 747-6666 x112



More information about the asterisk-users mailing list