mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7285 | tilghman | 2005-12-02 15:12:05 -0600 (Fri, 02 Dec 2005) | 2 lines Turn on executable bits for startup scripts, and fix bash var interpolation for Mandrake ........ r7299 | oej | 2005-12-02 19:24:40 -0600 (Fri, 02 Dec 2005) | 2 lines Documenting the default registerattempts setting as 0, continue hammering the server for ever and ever ;-) ........ r7310 | tilghman | 2005-12-03 13:55:05 -0600 (Sat, 03 Dec 2005) | 3 lines Bug 5925: check for "Unknown", as that's what app_voicemail puts into the field for Unknown callerid Also, remove useless res checks (initialized to 0; never set) ........ r7329 | kpfleming | 2005-12-04 12:03:07 -0600 (Sun, 04 Dec 2005) | 2 lines use a more efficient way to get the revision number, that will also report if the working copy contains uncommitted modifications ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7330 65c4cc65-6c06-0410-ace0-fbb531ad65f3
		
			
				
	
	
		
			99 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			99 lines
		
	
	
		
			1.7 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
 | |
| 
 | |
| # 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
 | |
| 
 |