diff options
Diffstat (limited to '1.2-netsec/contrib/init.d')
-rwxr-xr-x | 1.2-netsec/contrib/init.d/rc.debian.asterisk | 85 | ||||
-rwxr-xr-x | 1.2-netsec/contrib/init.d/rc.gentoo.asterisk | 17 | ||||
-rwxr-xr-x | 1.2-netsec/contrib/init.d/rc.mandrake.asterisk | 183 | ||||
-rwxr-xr-x | 1.2-netsec/contrib/init.d/rc.mandrake.zaptel | 98 | ||||
-rwxr-xr-x | 1.2-netsec/contrib/init.d/rc.redhat.asterisk | 118 | ||||
-rwxr-xr-x | 1.2-netsec/contrib/init.d/rc.slackware.asterisk | 42 |
6 files changed, 0 insertions, 543 deletions
diff --git a/1.2-netsec/contrib/init.d/rc.debian.asterisk b/1.2-netsec/contrib/init.d/rc.debian.asterisk deleted file mode 100755 index 16e7706fd..000000000 --- a/1.2-netsec/contrib/init.d/rc.debian.asterisk +++ /dev/null @@ -1,85 +0,0 @@ -#! /bin/sh -# $Id: asterisk,v 1.3 2005/11/17 22:30:01 Gregory Boehnlein <damin@nacs.net> -# -# asterisk start the asterisk PBX -# -# Thu Nov 17 2005 Gregory Boehnlein <damin@nacs.net> -# - Updated Version to 1.3 -# - Reversed behavior of LD_ASSUME_KERNEL=2.4.1 -# - Added detailed failure messages -# -# Sun Jul 18 2004 Gregory Boehnlein <damin@nacs.net> -# - Updated Version to 1.2 -# - Added test for safe_asterisk -# - Changed "stop gracefully" to "stop now" -# - Added support for -U and -G command line options -# - Modified "reload" to call asterisk -rx 'reload' - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -NAME=asterisk -DESC="Asterisk PBX" -# Full path to asterisk binary -DAEMON=/usr/sbin/asterisk - -# Full path to safe_asterisk script -SAFE_ASTERISK=/usr/sbin/safe_asterisk - -# Uncomment this ONLY if you know what you are doing. -# export LD_ASSUME_KERNEL=2.4.1 - -# Uncomment the following and set them to the user/groups that you -# want to run Asterisk as. NOTE: this requires substantial work to -# be sure that Asterisk's environment has permission to write the -# files required for its operation, including logs, its comm -# socket, the asterisk database, etc. -#AST_USER="asterisk" -#AST_GROUP="asterisk" - -if ! [ -x $DAEMON ] ; then - echo "ERROR: /usr/sbin/asterisk not found" - exit 0 -fi - -if ! [ -d /etc/asterisk ] ; then - echo "ERROR: /etc/asterisk directory not found" - exit 0 -fi - -set -e - -case "$1" in - start) - echo -n "Starting $DESC: " - if [ -f $SAFE_ASTERISK ] ; then - DAEMON=$SAFE_ASTERISK - fi - if [ $AST_USER ] ; then - ASTARGS="-U $AST_USER" - fi - if [ $AST_GROUP ] ; then - ASTARGS="`echo $ASTARGS` -G $AST_GROUP" - fi - start-stop-daemon --start --exec $DAEMON -- $ASTARGS - echo "$NAME." - ;; - stop) - echo -n "Stopping $DESC: " - $DAEMON -rx 'stop now' > /dev/null 2> /dev/null && echo -n "$NAME" - echo "." - exit 0 - ;; - reload) - echo "Reloading $DESC configuration files." - $DAEMON -rx 'reload' > /dev/null 2> /dev/null - ;; - restart|force-reload) - $DAEMON -rx 'restart gracefully' > /dev/null 2> /dev/null && echo -n "$NAME" - ;; - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/1.2-netsec/contrib/init.d/rc.gentoo.asterisk b/1.2-netsec/contrib/init.d/rc.gentoo.asterisk deleted file mode 100755 index ae7520066..000000000 --- a/1.2-netsec/contrib/init.d/rc.gentoo.asterisk +++ /dev/null @@ -1,17 +0,0 @@ -#!/sbin/runscript - -depend() { - need net logger -} - -start() { - ebegin "Starting Asterisk" - /usr/sbin/asterisk - eend $? "Failed to start Asterisk" -} - -stop() { - ebegin "Stopping Asterisk" - kill $(cat /var/run/asterisk.pid) - eend $? "Failed to stop Asterisk" -} diff --git a/1.2-netsec/contrib/init.d/rc.mandrake.asterisk b/1.2-netsec/contrib/init.d/rc.mandrake.asterisk deleted file mode 100755 index 702de53dc..000000000 --- a/1.2-netsec/contrib/init.d/rc.mandrake.asterisk +++ /dev/null @@ -1,183 +0,0 @@ -#!/bin/sh -# -# asterisk: Starts the asterisk service -# -# Version: @(#) /etc/rc.d/init.d/asterisk 1.0 -# -# chkconfig: 2345 95 10 -# description: Starts the asterisk service -# -# processname: asterisk -# - -TTY=9 # TTY (if you want one) for Asterisk to run on -CONSOLE=yes # Whether or not you want a console -NOTIFY=root # Who to notify about crashes -DUMPDROP=/tmp -HOSTNAME=`hostname` -if [ 0`readlink $0` = "0" ]; then - CONFIGFILE=/etc/sysconfig/`basename $0` -else - CONFIG0=`readlink $0` - CONFIGFILE=/etc/sysconfig/`basename $CONFIG0` -fi - -# Setup environment -cd /usr/src -if [ -f /usr/lib/asterisk/modules/chan_h323.so -a `grep -c ^noload=chan_h323.so /etc/asterisk/modules.conf` -eq 0 ]; then - OPENH323DIR=/usr/src/h323/openh323 - PWLIBDIR=/usr/src/h323/pwlib -else - OPENH323DIR=/usr/src/oh323/openh323 - PWLIBDIR=/usr/src/oh323/pwlib -fi - -# Put overrides in /etc/sysconfig/asterisk -[ -f $CONFIGFILE ] && . $CONFIGFILE - -LD_LIBRARY_PATH=$OPENH323DIR/lib:$PWLIBDIR/lib -export OPENH323DIR PWLIBDIR LD_LIBRARY_PATH - -# Source function library. -. /etc/rc.d/init.d/functions - -# -# Don't fork when running "safely" -# -ASTARGS="-p" -if [ "$TTY" != "" ]; then - if [ -c /dev/tty${TTY} ]; then - TTY=tty${TTY} - elif [ -c /dev/vc/${TTY} ]; then - TTY=vc/${TTY} - else - echo "Cannot find your TTY (${TTY})" >&2 - exit 1 - fi - ASTARGS="${ASTARGS} -vvv" - if [ "$CONSOLE" != "no" ]; then - ASTARGS="${ASTARGS} -c" - fi -fi -if [ ! -w ${DUMPDROP} ]; then - echo "Cannot write to ${DUMPDROP}" >&2 - exit 1 -fi - -# -# Let Asterisk dump core -# -ulimit -c unlimited - -#launch_asterisk() -#{ -#} - -SIGMSG=("None", "Hangup" "Interrupt" "Quit" "Illegal instruction" "Trace trap" "IOT Trap" "Bus Error" "Floating-point exception" "Killed" "User-defined signal 1" "Segmentation violation" "User-defined signal 2" "Broken pipe" "Alarm clock" "Termination" "Stack fault") - -run_asterisk() -{ - while :; do - - if [ "$TTY" != "" ]; then - cd /tmp - stty sane < /dev/${TTY} - asterisk ${ASTARGS} > /dev/${TTY} 2>&1 < /dev/${TTY} - else - cd /tmp - asterisk ${ASTARGS} - fi - EXITSTATUS=$? - echo "Asterisk ended with exit status $EXITSTATUS" - if [ "$EXITSTATUS" = "0" ]; then - # Properly shutdown.... - echo "Asterisk shutdown normally." - exit 0 - elif [ $EXITSTATUS -gt 128 ]; then - EXITSIGNAL=$(($EXITSTATUS - 128)) - EXITMSG=${SIGMSG[$EXITSIGNAL]} - echo "Asterisk exited on signal $EXITSIGNAL - $EXITMSG." - if [ "$NOTIFY" != "" ]; then - echo "Asterisk exited on signal $EXITSIGNAL - $EXITMSG. Might want to take a peek." | \ - mail -s "Asterisk Died ($HOSTNAME)" $NOTIFY - fi - if [ -f /tmp/core ]; then - mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` & - fi - else - echo "Asterisk died with code $EXITSTATUS. Aborting." - if [ -f /tmp/core ]; then - mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` & - fi - exit 0 - fi - echo "Automatically restarting Asterisk." - done -} - -case "$1" in - start) - gprintf "Starting asterisk: " - run_asterisk >/dev/null 2>&1 & - sleep 2 # Give it time to die - succeeded=`pidof asterisk|awk '{print NF}'` - if [ $succeeded = "0" ]; then - failure - else - success - fi - echo - ;; - stop) - gprintf "Stopping asterisk: " - asterisk -r -x "stop gracefully" >/dev/null 2>&1 - killall -9 mpg123 2>/dev/null - success - echo - ;; - restart) - $0 stop - usleep 100000 - $0 start - ;; - reload) - gprintf "Reloading asterisk: " - asterisk -r -x "reload" >/dev/null 2>&1 - success - echo - ;; - stopnow) - gprintf "Stopping asterisk: " - asterisk -r -x "stop now" >/dev/null 2>&1 - success - echo - ;; - restartnow) - $0 stopnow - $0 start - ;; - fullrestart) - $0 stop - service zaptel restart - $0 start - ;; - fullrestartnow) - $0 stopnow - service zaptel restart - $0 start - ;; - status) - succeeded=`pidof asterisk|awk '{print NF}'` - if [ $succeeded = "0" ]; then - echo "Asterisk is not running" - else - echo "Asterisk is currently running with $succeeded threads" - fi - ;; - *) - gprintf "*** Usage: $0 {start|stop[now]|reload|[full]restart[now]|status}\n" - exit 1 -esac - -exit 0 - diff --git a/1.2-netsec/contrib/init.d/rc.mandrake.zaptel b/1.2-netsec/contrib/init.d/rc.mandrake.zaptel deleted file mode 100755 index c5c26000e..000000000 --- a/1.2-netsec/contrib/init.d/rc.mandrake.zaptel +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh -# -# zaptel: Loads Asterisk modules -# -# Version: @(#) /etc/rc.d/init.d/zaptel 1.0 -# -# chkconfig: 2345 90 10 -# description: Loads and unloads zaptel modules at boot time and shutdown. -# -# hide: true - -# Source function library. -. /etc/rc.d/init.d/functions - -# Default modules - override in /etc/sysconfig/zaptel -###################################### -MODULES="usb-uhci zaptel wcfxo wcusb" -###################################### - -[ -f /etc/sysconfig/`basename $0` ] && . /etc/sysconfig/`basename $0` - -function probe() { - gprintf " $1" - modprobe -i $1 - # It has to be in the module list, otherwise something is wrong - if lsmod | grep -c ^$1 >/dev/null; then - success - else - failure - fi - echo -} - -function unprobe() { - gprintf " $1" - rmmod $1 >/dev/null 2>&1 - # If it's still in the module list after removing it, there's something wrong. - if lsmod | grep -c ^$1 >/dev/null; then - failure - else - success - fi - echo -} - -function reverse_modules() { - tmp=$MODULES - MODULES='' - for i in $tmp; do - MODULES="$i $MODULES" ; - done -} - -# See how we were called. -case "$1" in - start) - gprintf "Loading Asterisk modules:\n" - for i in $MODULES; do - probe $i - usleep 100000 ; - done - ztcfg - ;; - stop) - gprintf "Unloading Asterisk modules:\n" - reverse_modules - for i in $MODULES; do - unprobe $i - usleep 100000 ; - done - ;; - status) - #ztcfg -vv - OK=1 - gprintf "Checking Asterisk modules" - for i in $MODULES; do - if [ `lsmod | grep -c $i` -eq 0 ]; then - OK=0 - fi - done - if [ $OK -gt 0 ]; then - success - else - failure - fi - echo - ;; - restart) - $0 stop - $0 start - ;; - *) - gprintf "*** Usage: $0 {start|stop|status|restart}\n" - exit 1 -esac - -exit 0 - diff --git a/1.2-netsec/contrib/init.d/rc.redhat.asterisk b/1.2-netsec/contrib/init.d/rc.redhat.asterisk deleted file mode 100755 index 1ef812463..000000000 --- a/1.2-netsec/contrib/init.d/rc.redhat.asterisk +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh -# $Id: asterisk,v 1.3 2005/11/17 22:30:01 Gregory Boehnlein <damin@nacs.net> -# -# asterisk Starts, Stops and Reloads Asterisk. -# -# chkconfig: 2345 40 60 -# description: Asterisk PBX and telephony daemon. -# processname: asterisk -# pidfile: /var/run/asterisk.pid -# -# Thu Nov 17 2005 Gregory Boehnlein <damin@nacs.net> -# - Updated Version to 1.3 -# - Reversed behavior of LD_ASSUME_KERNEL=2.4.1 -# - Added detailed failure messages -# -# Sun Jul 18 2004 Gregory Boehnlein <damin@nacs.net> -# - Updated Version to 1.2 -# - Added test for safe_asterisk -# - Verified SIGTERM issued by "killproc" ensures "stop gracefully" -# - Added support for -U and -G command line options -# - Modified "reload" to call asterisk -rx 'reload' - -# Source function library. -. /etc/rc.d/init.d/functions - -if ! [ -x /usr/sbin/asterisk ] ; then - echo "ERROR: /usr/sbin/asterisk not found" - exit 0 -fi - -if ! [ -d /etc/asterisk ] ; then - echo "ERROR: /etc/asterisk directory not found" - exit 0 -fi - -# Uncomment this ONLY if you know what you are doing. -# export LD_ASSUME_KERNEL=2.4.1 - -# Full path to asterisk binary -DAEMON=/usr/sbin/asterisk - -# Full path to safe_asterisk script -SAFE_ASTERISK=/usr/sbin/safe_asterisk - -# Uncomment the following and set them to the user/groups that you -# want to run Asterisk as. NOTE: this requires substantial work to -# be sure that Asterisk's environment has permission to write the -# files required for its operation, including logs, its comm -# socket, the asterisk database, etc. -#AST_USER="asterisk" -#AST_GROUP="asterisk" - -RETVAL=0 - -start() { - # Start daemons. - echo -n $"Starting asterisk: " - if [ -f $SAFE_ASTERISK ] ; then - DAEMON=$SAFE_ASTERISK - fi - if [ $AST_USER ] ; then - ASTARGS="-U $AST_USER" - fi - if [ $AST_GROUP ] ; then - ASTARGS="`echo $ASTARGS` -G $AST_GROUP" - fi - daemon $DAEMON $ASTARGS - RETVAL=$? - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk - echo - return $RETVAL -} - -stop() { - # Stop daemons. - echo -n $"Shutting down asterisk: " - killproc asterisk - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/asterisk - echo - return $RETVAL -} - -restart() { - stop - start -} - -reload() { - $DAEMON -rx 'reload' > /dev/null 2> /dev/null -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - restart - ;; - reload) - reload - ;; - condrestart) - [ -f /var/lock/subsys/asterisk ] && restart || : - ;; - status) - status asterisk - ;; - *) - echo "Usage: asterisk {start|stop|restart|reload|condrestart|status}" - exit 1 -esac - -exit $? diff --git a/1.2-netsec/contrib/init.d/rc.slackware.asterisk b/1.2-netsec/contrib/init.d/rc.slackware.asterisk deleted file mode 100755 index 676345909..000000000 --- a/1.2-netsec/contrib/init.d/rc.slackware.asterisk +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# -# Start/stop/restart Asterisk PBX -# -# Version: 1.0 - Paul Belanger <pabelanger@gmail.com> -# -# 03.29.2005 - Initial Version -# - -asterisk_start() { - if [ -x /usr/sbin/asterisk ]; then - echo "Starting Asterisk /usr/sbin/asterisk" - /usr/sbin/asterisk - fi -} - -asterisk_stop() { - # If there is no PID file, ignore this request... - if [ -r /var/run/asterisk.pid ]; then - killall asterisk - fi -} - -asterisk_restart() { - asterisk_stop - asterisk_start -} - -case "$1" in - 'start') - asterisk_start - ;; - 'stop') - asterisk_stop - ;; - 'restart') - asterisk_restart - ;; - *) - echo "usage $0 start|stop|restart" ;; -esac - |