Benutzer-Werkzeuge

Webseiten-Werkzeuge

voipworkshop:init-script
#!/bin/bash */
/*  */
/*  asterisk      Startup script for the asterisk server */
/*                Klaus.Franken@StrukturPunkt.de */
/*  */
/*  chkconfig: - 85 15 */
/*  description: Asterisk PBX */
/*  processname: asterisk */
/*  config: /etc/asterisk/sip.conf */
/*  config: /etc/asterisk/extensions.conf */
/*  pidfile: /var/run/asterisk.pid */

/*  Source function library. */
. /etc/rc.d/init.d/functions

if [[|-f /etc/sysconfig/asterisk ]]; then
        . /etc/sysconfig/asterisk
fi

prog=asterisk
pidfile=${PIDFILE-/var/run/asterisk.pid}
pidfile2=${PIDFILE-/var/run/asterisk_loop.pid}
RETVAL=0

start() {
        echo -n $"Starting $prog: "
        modprobe ztdummy # for conferences
        daemon $prog
        RETVAL=$?
        if test -r /var/www/webtel/kibeon/cgi-bin/asterix_loop.sh; then
            sleep 1
            /var/www/webtel/kibeon/cgi-bin/asterix_loop.sh >> /var/log/asterisk_loop.log 2>&1 &
            loopPid=$!
            echo $! > $pidfile2
        fi
        echo
        #[[|$RETVAL = 0 ]] && touch ${lockfile}
        asterisk -rx "core set verbose 9"
        return $RETVAL
}
stop() {
        echo -n $"Stopping Asterisk"
        asterisk -rx "stop now"
        loopPid=''
        test -r $pidfile2 && loopPid=`cat $pidfile2`
        test ! -z $loopPid && kill $loopPid
        rm -f $pidfile2
        echo
}
reload() {
        echo -n $"Reloading Asterisk-Configuration"
        echo
        asterisk -rx "reload"
        echo
}
graceful() {
        echo -n $"Restarting  Asterisk gracefully"
        asterisk -rx "restart gracefully"
        echo
        channels
}
channels() {
        echo $"activ channels:"
        asterisk -rx "sip show channels"
        asterisk -rx "iax2 show channels"
        echo
}

/*  See how we were called. */
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        channels
        status $prog
        RETVAL=$?
        ;;
  restart)
        stop
        sleep 1
        start
        ;;
  condrestart)
        if [[|-f ${pidfile} ]] ; then
                stop
                sleep 1
                start
        fi
        ;;
  reload)
        reload
        ;;
  channels)
        channels
        ;;
  graceful|gracefully)
        graceful
        ;;
    * )
        echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|channels|graceful}"
        exit 1
esac

exit $RETVAL
Permalink voipworkshop/init-script.txt · Zuletzt geändert: 08.09.2008 14:29 von kfr

oeffentlich