cd81d42594
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r67061 | tilghman | 2007-06-04 12:11:43 -0500 (Mon, 04 Jun 2007) | 10 lines Merged revisions 67060 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r67060 | tilghman | 2007-06-04 12:10:30 -0500 (Mon, 04 Jun 2007) | 2 lines Add revision Id tags (by request of tzafrir) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67062 f38db490-d61c-443f-a65b-d21fe96a405b
109 lines
1.9 KiB
Bash
Executable file
109 lines
1.9 KiB
Bash
Executable file
#!/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
|
|
|
|
# $Id$
|
|
|
|
# Source function library.
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
# Default modules - override in /etc/sysconfig/zaptel
|
|
######################################
|
|
MODULES="usb-uhci zaptel wcfxo wcusb"
|
|
######################################
|
|
|
|
# Resolve back to the basename (i.e. zaptel, not S90zaptel)
|
|
if [ 0`readlink $0` = "0" ]; then
|
|
CONFIGFILE=/etc/sysconfig/`basename $0`
|
|
else
|
|
CONFIG0=`readlink $0`
|
|
CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
|
|
fi
|
|
|
|
[ -f $CONFIGFILE ] && . $CONFIGFILE
|
|
|
|
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
|
|
|