aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/init.d/rc.mandrake.zaptel
diff options
context:
space:
mode:
authorjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2004-01-11 10:17:38 +0000
committerjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2004-01-11 10:17:38 +0000
commit00e98ce728c95484d19a604da51ba4fae55cad7a (patch)
treeb433c3bfca0de36915f8da8bea431750f0d9c05b /contrib/init.d/rc.mandrake.zaptel
parent98acc69ae68b8d2a548340895b32b132d3c6094c (diff)
Add Corydon76's mandrake startup scripts. Bug #312
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1941 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'contrib/init.d/rc.mandrake.zaptel')
-rwxr-xr-xcontrib/init.d/rc.mandrake.zaptel84
1 files changed, 84 insertions, 0 deletions
diff --git a/contrib/init.d/rc.mandrake.zaptel b/contrib/init.d/rc.mandrake.zaptel
new file mode 100755
index 000000000..731d9c379
--- /dev/null
+++ b/contrib/init.d/rc.mandrake.zaptel
@@ -0,0 +1,84 @@
+#!/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
+
+######################################
+# CONFIGURE ME !!!
+######################################
+MODULES="usb-uhci zaptel wcfxo wcusb"
+######################################
+
+function probe() {
+ gprintf " $1"
+ modprobe $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
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ gprintf "*** Usage: $0 {start|stop|status|restart}\n"
+ exit 1
+esac
+
+exit 0
+