[asterisk-users] SuSE 10.1 zaptel init script
Manolis Kaliotis
m.kaliotis at bytewise.gr
Fri Aug 11 19:09:07 MST 2006
Hello list.
I modified a bit the zaptel init scripts so as to become more SuSE
friendly (with rc_status!!!).
Here are the two scripts: zaptel.init and zaptel.sysconfig
Thanks,
./manolis
-------------- next part --------------
TELEPHONY=yes
#DEBUG=yes
# Un-comment as per your requirements; modules to load/unload
#Module Name Hardware
#MODULES="$MODULES tor2" # T400P - Quad Span T1 Card
# E400P - Quad Span E1 Card
#MODULES="$MODULES wct4xxp" # TE405P - Quad Span T1/E1 Card (5v version)
# TE410P - Quad Span T1/E1 Card (3.3v version)
#MODULES="$MODULES wct1xxp" # T100P - Single Span T1 Card
# E100P - Single Span E1 Card
#MODULES="$MODULES wcte11xp" # TE110P - Single Span T1/E1 Card
#MODULES="$MODULES wctdm24xxp" # TDM2400P - Modular FXS/FXO interface (1-24 ports)
#MODULES="$MODULES wcfxo" # X100P - Single port FXO interface
# X101P - Single port FXO interface
#MODULES="$MODULES wctdm" # TDM400P - Modular FXS/FXO interface (1-4 ports)
#MODULES="$MODULES wcfxs" # either above or this
#MODULES="$MODULES wcusb" # S100U - Single port FXS USB Interface
#MODULES="$MODULES wcfxsusb" # either above or this
#MODULES="$MODULES torisa" # Old Tormenta1 ISA Card
MODULES="$MODULES ztdummy" # UHCI USB Zaptel Timing Only Interface
#MODULES="$MODULES xpp xpp_usb" # Xorcom Astribank Device
-------------- next part --------------
#!/bin/sh
#
# zaptel This shell script takes care of loading and unloading \
# Zapata Telephony interfaces
# chkconfig: 2345 9 92
# description: The zapata telephony drivers allow you to use your linux \
# computer to accept incoming data and voice interfaces
#
# config: /etc/sysconfig/zaptel
initdir=/etc/init.d
#
# Determine which kind of configuration we're using
#
system=redhat # assume redhat
if [ -f /etc/debian_version ]; then
system=debian
fi
# Source function library.
#if [ $system = redhat ]; then
# . $initdir/functions || exit 0
#fi
. /etc/rc.status
# Source zaptel configuration.
if [ $system = debian ]; then
[ -f /etc/default/zaptel ] && . /etc/default/zaptel
elif [ $system = redhat ]; then
[ -f /etc/sysconfig/zaptel ] && . /etc/sysconfig/zaptel
fi
if [ -z "${MODULES}" ]; then
# Populate defaults if not present
MODULES="tor2 wct4xxp wct1xxp wcte11xp wcfxo wctdm wctdm24xxp"
fi
RMODULES=""
# Reverse list for un-loading; don't change
for x in $MODULES; do
RMODULES="$x $RMODULES"
done
# Check that telephony is up.
[ "${TELEPHONY}" = "yes" ] || exit 0
[ -f /sbin/ztcfg ] || exit 0
[ -f /etc/zaptel.conf ] || exit 0
if [ "${DEBUG}" = "yes" ]; then
ARGS="debug=1"
fi
RETVAL=0
rc_reset
# See how we were called.
case "$1" in
start)
# Load drivers
rmmod wcusb >& /dev/null
rmmod wcfxsusb >& /dev/null
rmmod audio >& /dev/null
if [ $system = debian ]; then
echo -n "Loading zaptel framework: "
modprobe zaptel >& /dev/null && echo -n "done"
echo "."
elif [ $system = redhat ]; then
echo -n "Loading zaptel framework: "
modprobe zaptel
rc_status -v
fi
echo -n "Waiting for zap to come online..."
TMOUT=10 # max secs to wait
while [ ! -d /dev/zap ] ; do
sleep 1
TMOUT=`expr $TMOUT - 1`
if [ $TMOUT -eq 0 ] ; then
echo "Error: missing /dev/zap!"
rc_status -v
exit 1
fi
rc_status -v
done
echo -n "Loading zaptel hardware modules:"
for x in $MODULES; do
if modprobe ${x} ${ARGS} >& /dev/null; then
echo -n " $x"
fi
rc_status -v
done
sleep 3
if [ ! -e /proc/zaptel/1 ]; then
echo "No functioning zap hardware found in /proc/zaptel, loading ztdummy"
modprobe ztdummy >& /dev/null
rc_status -v
fi
if [ $system = debian ]; then
echo -n "Running ztcfg: "
/sbin/ztcfg >& /dev/null && echo -n "done"
echo "."
elif [ $system = redhat ]; then
echo -n "Running ztcfg: "
/sbin/ztcfg
rc_status -v
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/zaptel
;;
stop)
# Unload drivers
echo -n "Unloading zaptel hardware drivers:"
for x in $RMODULES; do
if rmmod ${x} >& /dev/null; then
echo -n " $x"
rc_status -v
fi
done
if [ $system = debian ]; then
echo -n "Removing zaptel module: "
rmmod zaptel >& /dev/null && echo -n "done"
echo "."
elif [ $system = redhat ]; then
echo -n "Removing zaptel module: "
rmmod zaptel
rc_status -v
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zaptel
;;
restart)
$0 stop
$0 start
;;
reload)
if [ $system = debian ]; then
echo -n "Reloading ztcfg: "
/sbin/ztcfg >& /dev/null && echo -n "done"
echo "."
elif [ $system = redhat ]; then
echo "Reloading ztcfg: "
/sbin/ztcfg
rc_status -v
fi
RETVAL=$?
;;
*)
echo "Usage: zaptel {start|stop|restart|reload}"
exit 1
esac
rc_reset
exit $RETVAL
-------------- next part --------------
A non-text attachment was scrubbed...
Name: m.kaliotis.vcf
Type: text/x-vcard
Size: 285 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20060811/8bf47133/m.kaliotis.vcf
More information about the asterisk-users
mailing list