返回列表 發帖

第一次compile左asterisk gui,但點樣可以auto start?

如題,是否每次都要輸入“asterisk -rvvvv"?

我已看過 http://www.telecom-cafe.com/foru ... &extra=page%3D2
但搞唔到,請問ching應該點做?

回復 10# 角色

用緊兩張sd card,一卡自己compile asterisk 已完成,其他未有搞住,因為另一張卡裝左ck兄既pre-image,而家試緊設定!
但係當中發現,如果router唔compatible會導致內線無法註冊情況發生,呢樣野搞左好耐才發現到

TOP

搞好没有?

TOP

THKS! Try Try sin

TOP

asterisk start up scripts for debian
  1. #! /bin/sh
  2. # $Id: rc.debian.asterisk 379790 2013-01-21 20:40:13Z mjordan $
  3. #
  4. # Mon Jun 04 2007 Iñaki Baz Castillo <ibc@in.ilimit.es>
  5. # - Eliminated SAFE_ASTERISK since it doesn't work as LSB script (it could require a independent "safe_asterisk" init script).
  6. # - Load and use the standar "/lib/lsb/init-functions".
  7. # - Added "--oknodo" to "start-stop-daemon" for compatibility with LSB:
  8. #   http://www.linux-foundation.org/spec/refspecs/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
  9. #
  10. # Thu Nov 17 2005 Gregory Boehnlein <damin@nacs.net>
  11. # - Reversed behavior of LD_ASSUME_KERNEL=2.4.1
  12. # - Added detailed failure messages
  13. #
  14. # Sun Jul 18 2004 Gregory Boehnlein <damin@nacs.net>
  15. # - Added test for safe_asterisk
  16. # - Changed "stop gracefully" to "stop now"
  17. # - Added support for -U and -G command line options
  18. # - Modified "reload" to call asterisk -rx 'reload'

  19. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  20. NAME=asterisk
  21. DESC="Asterisk PBX"
  22. # Full path to asterisk binary
  23. DAEMON=/usr/sbin/asterisk
  24. ASTVARRUNDIR=/var/run/asterisk
  25. ASTETCDIR=/etc/asterisk
  26. TRUE=/bin/true

  27. ### BEGIN INIT INFO
  28. # Provides:                asterisk
  29. # Required-Start:    $network $syslog $named $local_fs $remote_fs
  30. # Required-Stop:     $network $syslog $named $local_fs $remote_fs
  31. # Should-Start:      dahdi misdn lcr wanrouter mysql postgresql
  32. # Should-Stop:       dahdi misdn lcr wanrouter mysql postgresql
  33. # Default-Start:        2 3 4 5
  34. # Default-Stop:                0 1 6
  35. # Short-Description:        Asterisk PBX
  36. # Description:                the Asterisk Open Source PBX
  37. ### END INIT INFO

  38. set -e

  39. if ! [ -x $DAEMON ] ; then
  40.         echo "ERROR: $DAEMON not found"
  41.         exit 0
  42. fi

  43. if ! [ -d $ASTETCDIR ] ; then
  44.         echo "ERROR: $ASTETCDIR directory not found"
  45.         exit 0
  46. fi

  47. # Use the LSB standard functions for services management
  48. . /lib/lsb/init-functions

  49. # Allow configuration overrides in /etc/default/asterisk
  50. CONFIG0=`readlink $0 || :` # readlink returns 1 when something isn't a symlink
  51. if [ "$CONFIG0" = "" ]; then
  52.         CONFIGFILE=/etc/default/`basename $0`
  53. else
  54.         CONFIGFILE=/etc/default/`basename $CONFIG0`
  55. fi
  56. [ -r $CONFIGFILE ] && . $CONFIGFILE

  57. case "$1" in
  58.   start)
  59.         # Check if Asterisk is already running.  If it is, then bug out, because
  60.         # starting up Asterisk when Asterisk is already running is very bad.
  61.         VERSION=`${DAEMON} -rx 'core show version' 2>/dev/null || ${TRUE}`
  62.         if [ "`echo $VERSION | cut -c 1-8`" = "Asterisk" ]; then
  63.                 echo "Asterisk is already running.  $0 will exit now."
  64.                 exit 0
  65.         fi

  66.         log_begin_msg "Starting $DESC: $NAME"
  67.         if [ ! -d $ASTVARRUNDIR ]; then
  68.                 mkdir -p $ASTVARRUNDIR
  69.         fi
  70.         if [ $AST_USER ] ; then
  71.                 ASTARGS="-U $AST_USER"
  72.                 chown $AST_USER $ASTVARRUNDIR
  73.         fi
  74.         if [ $AST_GROUP ] ; then
  75.                 ASTARGS="$ASTARGS -G $AST_GROUP"
  76.                 chgrp $AST_GROUP $ASTVARRUNDIR
  77.         fi
  78.         if [ $ALTCONF ]; then
  79.                 ASTARGS="$ASTARGS -C \"$ALTCONF\""
  80.         fi
  81.         if [ "x$COREDUMP" = "xyes" ]; then
  82.                 ASTARGS="$ASTARGS -g"
  83.         fi
  84.         if [ "0$MAXLOAD" -gt "0" ]; then
  85.                 ASTARGS="$ASTARGS -L $MAXLOAD"
  86.         fi
  87.         if [ "0$MAXCALLS" -gt "0" ]; then
  88.                 ASTARGS="$ASTARGS -M $MAXCALLS"
  89.         fi
  90.         if [ "0$VERBOSITY" -gt "0" ]; then
  91.                 for i in `seq 1 $VERBOSITY`; do
  92.                         ASTARGS="$ASTARGS -v"
  93.                 done
  94.                 # -v implies -f, so we override that implicit specification here
  95.                 ASTARGS="$ASTARGS -F"
  96.         fi
  97.         if [ "x$INTERNALTIMING" = "xyes" ]; then
  98.                 ASTARGS="$ASTARGS -I"
  99.         fi
  100.         if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o "x$TMPRECORDINGLOCATION" = "xyes" ]; then
  101.                 ASTARGS="$ASTARGS -t"
  102.         fi
  103.         if test "x$COLOR" = "xno" ; then
  104.                 ASTARGS="$ASTARGS -n"
  105.         fi
  106.         # "start-stop-daemon --oknodo" returns 0 even if Asterisk was already running (as LSB expects):
  107.         start-stop-daemon --start --oknodo --exec $DAEMON -- $ASTARGS
  108.         log_end_msg $?
  109.         ;;
  110.   stop)
  111.         log_begin_msg "Stopping $DESC: $NAME"
  112.         # "start-stop-daemon --oknodo" returns 0 even if Asterisk was already stopped (as LSB expects):
  113.         start-stop-daemon --stop --oknodo --exec $DAEMON
  114.         log_end_msg $?
  115.         ;;
  116.   reload)
  117.         echo "Reloading $DESC configuration files."
  118.         $DAEMON -rx 'module reload' > /dev/null 2> /dev/null
  119.         ;;
  120.   restart|force-reload)
  121.         $0 stop
  122.         sleep 2  # It needs some time to really be stopped.
  123.         $0 start
  124.         # "restart|force-reload" starts Asterisk and returns 0 even if Asterisk was stopped (as LSB expects).
  125.         ;;
  126.   status)
  127.        status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
  128.        ;;
  129.   *)
  130.         N=/etc/init.d/$NAME
  131.         echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
  132.         exit 1
  133.         ;;
  134. esac
複製代碼

TOP

還要改進動 asterisk file 內的 path

簡單方法是從 raspberry pi image 抄出來,放進 /etc/init.d
chmod a+x /etc/init.d/asterisk
update-rc.d asterisk defaults

TOP

佢意思係去compile asterisk果個folder, 內裡有個contrib/init.d , 裡面有個file叫rc.debian.asterisk, 將個file copy 去 /etc/init.d度, 並且要改名做 asterisk

動作係
cp rc.debian.asterisk /etc/init.d/asterisk


然後執行script
動作係
update-rc.d asterisk defaults

TOP

第一條link死左
第二條link睇到,但做唔到,無呢個folder /contrib/init.d

TOP

點用debian,有link嗎?

TOP

用Debian。

TOP

Auto-start都是follow 那些link去做。

TOP

返回列表