Min Hwan Chang
2005-Dec-09 16:31 UTC
[Asterisk-Users] Daily Reboot Script for Asterisk Question
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
Pete Barnwell
2005-Dec-09 16:33 UTC
[Asterisk-Users] Daily Reboot Script for Asterisk Question
On Fri, 2005-12-09 at 15:31 -0800, 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(a) Check for an asterisk process If it doesn't exist then exit of of the loop immediately If it does exist, wait 5 seconds then start again at (a) Pete
Mojo with Horan & Company, LLC
2005-Dec-09 18:15 UTC
[Asterisk-Users] Daily Reboot Script for Asterisk Question
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@horanappraisals.com> Office Manger, Horan & Company, LLC (907) 747-6666 x112
Roger Hill
2005-Dec-09 23:20 UTC
[Asterisk-Users] Daily Reboot Script for Asterisk Question
Basically, it's looping waiting for asterisk to disappear. Your first command says 'shutdown when convenient' The line in question looks to see if asterisk is still running - if it is, it waits 5 seconds then looks again. When it finds that asterisk is no longer running, it drops into the 'remove module' stuff. So it's making sure that asterisk has died before zapping the modules that asterisk needs. HTH Roger 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 > > >-- ######################################################## Roger Hill 07739 707 180 Perseverance is the hard work you do after you get tired of doing the hard work you already did. ########################################################
Doug Lytle
2005-Dec-10 06:46 UTC
[Asterisk-Users] Daily Reboot Script for Asterisk Question
Min Hwan Chang wrote:> 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) >Your logs show that the TDM was registered at 4:18am> 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 >Your out of memory errors occured at 7am and it appears to be sendmail causing the issue. Doug -- Ben Franklin quote: "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."