返回列表 發帖

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.

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

TOP

Firmware 4.0.X 尚算暢順,但因為仍未解決Asterisk Autorun 問題,我暫時downgrade 返回 firmware 3.8.3

TOP

你upgrade了Firmware 4.0吗?

TOP

請問有無師兄/師姐把 QNAP NAS 升級firmware 4.0.X 之後,仍然成功可以用以上的Autorun script 啟動Asterisk 呢?

TOP

回復 3# 雯雯

已经修正好。

TOP

回復 3# 雯雯

结果应该一样吧! 因为user只有一个。

TOP

回復 1# 角色

步驟9打錯了, 應為chmod +x ./asterisk-start.sh
Welcome to my TaoBao shop: http://mandymak520.taobao.com/

TOP

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

1007.png

TOP

返回列表