Board logo

標題: Autorun asterisk after reboot with updating /etc/host on QNAP TS-269 Pro [打印本頁]

作者: 角色    時間: 2012-10-29 02:42     標題: Autorun asterisk after reboot with updating /etc/host on QNAP TS-269 Pro

本帖最後由 角色 於 2012-11-2 21:32 編輯

怎样自动启动asterisk?

1) mount /dev/sdx6 /tmp/config

2) cd /tmp/config

3) vi autorun.sh and add the following
  1. #!/bin/sh

  2. #sym-link ./Optware to /opt
  3. rm -rf /opt
  4. ln -sf /share/MD0_DATA/.qpkg/Optware /opt

  5. #pass the start control to /opt/etc/init.d/asterisk-start.sh
  6. /share/MD0_DATA/.qpkg/Optware/etc/init.d/asterisk-start.sh &
複製代碼
4) chmod u+x autorun.sh

5) cd /

6) umount /tmp/config

7) cd /opt/etc/init.d

8) vi asterisk-start.sh and add
  1. #!/bin/sh

  2. {
  3.   ###
  4.   # Section 1: Changes that can be made immediately.
  5.   ###

  6.   #set environment variable
  7.   export LD_LIBRARY_PATH=/opt/lib

  8.   ###
  9.   # Section 2: Wait for it...
  10.   ###

  11.   date; echo "Waiting for boot process to complete."
  12.   while [ ! -f /tmp/.thttpd_alive ]; do
  13.     sleep 1
  14.   done
  15.   date; echo "Boot process completed, making custom changes."

  16.   ###
  17.   # Section 3: Changes after the boot processes have finished.
  18.   ###

  19.   # add 2b host names in /etc/hosts
  20.   cat >>/etc/hosts <<EOD
  21. 203.80.89.135   s2hkbntel.net s21.hkbntel.net
  22. EOD


  23.   # start /opt/sbin/asterisk
  24.   /opt/sbin/asterisk

  25.   # start /opt/asterisk-1.8/sbin/asterisk
  26.   /opt/asterisk-1.8/sbin/asterisk

  27.   # start /opt/asterisk-11/sbin/asterisk
  28.   /opt/asterisk-11/sbin/asterisk

  29. #  crontab /xyz/home/userx/crontab -u userx
  30. #  date; echo "autorun_subproc ended."
  31. } >/tmp/autorun_subproc.out 2>/tmp/autorun_subproc.err &
複製代碼
9. chmod +x ./asterisk-start.sh

10. Reboot using webadmin

11. After reboot, we are able to see three Asterisk servers running in parallel.

0094.png


Remarks:
1) In Step 8, the file /tmp/.boot_done was replaced by /tmp/.thttpd_alive because file did not appear.

2) Due to the command library called for the Google talk, only the first asterisk could use it, the rest of the two are not able to use it. If you want any particular asterisk to run Google Talk, that asterisk has to be placed at the front of all asterisk starters.

圖片附件: 0094.png (2012-10-29 03:46, 16.7 KB) / 下載次數 775
http://telecom-cafe.com/forum/attachment.php?aid=1783&k=d20e72fe5267671ea27bc2a34a6a8b26&t=1732302685&sid=5Wiw5q


作者: 角色    時間: 2012-10-29 09:00

Using the above autorun.sh script, the core show translation for Asterisk 11, we have

1007.png

圖片附件: 1007.png (2012-10-29 09:00, 49.67 KB) / 下載次數 700
http://telecom-cafe.com/forum/attachment.php?aid=1784&k=9b2c39ab6ffbae8e55b6e4d8081b492f&t=1732302685&sid=5Wiw5q


作者: 雯雯    時間: 2012-11-1 14:27

回復 1# 角色

步驟9打錯了, 應為chmod +x ./asterisk-start.sh
作者: 角色    時間: 2012-11-1 23:55

回復 3# 雯雯

结果应该一样吧! 因为user只有一个。
作者: 角色    時間: 2012-11-2 21:33

回復 3# 雯雯

已经修正好。
作者: bubblestar    時間: 2013-8-10 19:04

請問有無師兄/師姐把 QNAP NAS 升級firmware 4.0.X 之後,仍然成功可以用以上的Autorun script 啟動Asterisk 呢?
作者: 角色    時間: 2013-8-31 07:11

你upgrade了Firmware 4.0吗?
作者: bubblestar    時間: 2013-8-31 11:24

Firmware 4.0.X 尚算暢順,但因為仍未解決Asterisk Autorun 問題,我暫時downgrade 返回 firmware 3.8.3
作者: 角色    時間: 2013-9-2 00:25

其实那样修改,问题是boot完在/tmp有什么flag?




歡迎光臨 電訊茶室 (http://telecom-cafe.com/forum/) Powered by Discuz! 7.2