返回列表 發帖
本帖最後由 角色 於 2010-8-17 17:32 編輯

好了,这个帖子是专注ATCOM的IP-01 IP-PBX,如果大家有任何问题,欢迎跟帖讨论。


角色

TOP

本帖最後由 角色 於 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
  1. #!/bin/sh

  2. while [ 1 ]
  3. do
  4. IsAlive=`pidof asterisk`
  5. if [[ -z "$IsAlive" ]] ; then
  6. echo "Asterisk die at `date`" >> /persistent/DieLog

  7. #/etc/init.d/asterisk start  # disable by YH Fung on 31 July 2010
  8. reboot

  9. fi
  10. sleep 60
  11. done
複製代碼
/persistent/etc/RebootTime.sh
  1. #!/bin/sh

  2. # TIME is given by the following script is GMT instead of the local time.
  3. # For Hong Kong, if you want the IP-01 to reboot at 04:00, you have set the
  4. # GMT time 20:00. The following is a list of table for easy reference
  5. #
  6. #  HK Time    GMT
  7. #  03:00      19:00
  8. #  04:00      20:00

  9. while [ 1 ]
  10. do
  11.    TIME=`date | cut -c 12-16`

  12.    if [ "$TIME" == "20:00" ] ; then
  13.          echo "Asterisk is rebooted at `date`" >> /persistent/DieLog
  14.          reboot
  15.    fi
  16.    sleep 50
  17. done
複製代碼
The following script may be deleted later if necessary.
  1. echo "Asterisk is rebooted at `date`" >> /persistent/DieLog
複製代碼
The following scripts will run the above two scripts automatically when system reboot.

/persistent/etc/rc.d/S99local contains:
  1. #!/bin/sh

  2. /persistent/etc/IsAsteriskAlive.sh &
  3. /persistent/etc/RebootTime.sh &
  4. /bin/sh /etc/gen_checklist.sh >/dev/null 2>/dev/nul      
  5. /bin/sh /etc/checkip.sh >/dev/null 2>/dev/nul &         
複製代碼
The last two routines are for IP tracking which are discussed in other thread.

YH

TOP

角色兄坐言起行,總結一些IP01經常會出現的問題及解決方案。其他MEMBERS以後便無需四處張羅,便可以馬上解決一般所遇到的問題。  給你一個。。。讚!!

TOP

其实一个论坛是否多人参与,其中一项就是是否能找到所需要的资料,如果一进来,有人提问,但是没有回单,然后又没有新的东西学,那么新旧members都会流失。不管怎样,现在现在人气是少了一点,但是等集中讨论VoIP,我估计香港可以只有这里了。我也知道我们的能力有限,但是经过大家的努力和我的汇编能力,帖子会有很大的参考价值。

角色

TOP

本帖最後由 角色 於 2010-8-18 08:31 編輯

Error Message

The date command in the shell script is different from the interactive command mode. For instance:

Asterisk Time is Wed Aug 18 00:14:56 UTC 2010 (from shell script programme)
root:/persistent> date
Wed Aug 18 08:15:34 WST 2010

The date from programming script give the GMT instead of the local time.

YH

TOP

You have configured /etc/TZ for a proper time zone and date format

TOP

Already set to WST-8 (=GMT+8). Anyway I have already modifed the RebootTime.sh.

YH

TOP

现在我的IP-01每个凌晨4点钟就reboot一次。如果在reboot期间发现asterisk routine不存在,那么系统会再次reboot一次。我估计中间突然reboot的情况会大大减少。

注意在Dielog显示的时间为GMT,而不是local time (HKT),但是在console,我们打指令就是本地时间。

角色

TOP

返回列表