| 本帖最後由 角色 於 2010-8-18 09:25 編輯 
 Because of instability found in the ATCOM IP-01, the follwing two rountines are developed for taking care of any failure found and regularly reboot the system to keep the IP-01 in fresh condition during the day.
 
 The first routine IsAsteriskAlive.sh is repsonsbile for any Asterisk failure found. The codes was originally developed by ATCOM engineers and modified by me by replace the asterisk restart to reboot.
 
 The second routine RebootTime.sh is used to boot IP-01 every morning at 4:00AM in order to make the whole system fresh from any accumulated problems after a number of days running.
 
 /persistent/etc/IsAsteriskAlive.sh
 /persistent/etc/RebootTime.sh複製代碼#!/bin/sh
while [ 1 ]
do
IsAlive=`pidof asterisk`
if [[ -z "$IsAlive" ]] ; then
echo "Asterisk die at `date`" >> /persistent/DieLog
#/etc/init.d/asterisk start  # disable by YH Fung on 31 July 2010
reboot
fi
sleep 60
done
The following script may be deleted later if necessary.複製代碼#!/bin/sh
# TIME is given by the following script is GMT instead of the local time.
# For Hong Kong, if you want the IP-01 to reboot at 04:00, you have set the
# GMT time 20:00. The following is a list of table for easy reference
#
#  HK Time    GMT
#  03:00      19:00
#  04:00      20:00
while [ 1 ]
do
   TIME=`date | cut -c 12-16`
   if [ "$TIME" == "20:00" ] ; then
         echo "Asterisk is rebooted at `date`" >> /persistent/DieLog
         reboot
   fi
   sleep 50
done
The following scripts will run the above two scripts automatically when system reboot.複製代碼echo "Asterisk is rebooted at `date`" >> /persistent/DieLog 
 /persistent/etc/rc.d/S99local contains:
 The last two routines are for IP tracking which are discussed in other thread.複製代碼#!/bin/sh
/persistent/etc/IsAsteriskAlive.sh &
/persistent/etc/RebootTime.sh &
/bin/sh /etc/gen_checklist.sh >/dev/null 2>/dev/nul      
/bin/sh /etc/checkip.sh >/dev/null 2>/dev/nul &          
 YH
 |