[Asterisk-Users] Autostart Asterisk on Slackware?

Mr. James W. Laferriere babydr at baby-dragons.com
Tue Feb 15 18:30:00 MST 2005


 	Hello Goran ,  Try this ...  Please watch out for any wrapped
 	lines .  Hth ,  JimL

cat << EOF > /etc/rc.d/rc.asterisk
#!/bin/sh
# --verbose
# Start the ASTERISK server.
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=asterisk
DESC="Asterisk PBX"
# Full path to safe_asterisk script
SAFE_ASTERISK=/usr/sbin/safe_asterisk
ASTERISKDBN=asterisk
ASTERISKDN=/usr/sbin/${ASTERISKDBN}
ASTERISKCNFD=/etc/${ASTERISKDBN}
# Leave this set unless you know what you are doing.
export LD_ASSUME_KERNEL=2.4.1
# set -e
OPTS="-d -v -v -v"
# usage rc.asterisk , start/stop/restart/reload
usage()
{
     echo "Usage: $0 {start|stop|restart|reload}"
}
TCMD="$1"
if [ -f ${ASTERISKDN} -a -d ${ASTERISKCNFD} ]; then
   case "$1" in
     start)      [ "$TCMD" = "start" ] && \
                 echo -e "\tStarting ${DESC}"
                 if [ "$OPTS" = "" ]; then
                   $ASTERISKDN
                 else
                   $ASTERISKDN ${OPTS} >> /var/log/asterisk/debug 2>&1 &
                 fi
         ;;
     stop)       [ "$TCMD" = "stop" ] && \
                 echo -e "\tStopping ${DESC}"
                 $ASTERISKDN -rx 'stop now' 2>/dev/null > /dev/null
         ;;
     reload)     echo -e "\tReloading ${DESC}"
                 $ASTERISKDN -rx 'reload' 2>/dev/null > /dev/null
         ;;
     restart)    echo -e "\tRestarting ${DESC}"
                 $ASTERISKDN -rx 'restart gracefully'  2>/dev/null > /dev/null
         ;;
     *)          usage ;;
   esac
else
   echo -e "\t${ASTERISKDN} or ${ASTERISKCNFD} , Does not exist ."
   echo -e "\tPlease correct and re-reun this startup script"
fi
EOF

On Tue, 15 Feb 2005, Goran Dj. wrote:
> Maybe trivial question, but I cannot find an answer:
> How to autostart Asterisk (daemon) on Slackware 10? I know that I should
> put something in /etc/rc.d, but what?
-- 
        +------------------------------------------------------------------+
        | James   W.   Laferriere | System    Techniques | Give me VMS     |
        | Network        Engineer | 3542 Broken Yoke Dr. |  Give me Linux  |
        | babydr at baby-dragons.com | Billings , MT. 59105 |   only  on  AXP |
        +------------------------------------------------------------------+



More information about the asterisk-users mailing list