]> git.pld-linux.org Git - packages/dahdi-tools.git/blob - dahdi.init
- BR: pkgconfig
[packages/dahdi-tools.git] / dahdi.init
1 #!/bin/sh
2 #
3 # dahdi dahdi modules
4 #
5 # chkconfig:    345 85 15
6 # description:  DAHDI is a series of telephony interface devices often \
7 #   used with Asterisk
8 #
9
10 # Source function library
11 . /etc/rc.d/init.d/functions
12
13 # Get service config
14 [ -f /etc/sysconfig/dahdi ] && . /etc/sysconfig/dahdi
15
16 start() {
17         # Check if the service is already running?
18         if [ ! -f /var/lock/subsys/dahdi ]; then
19                 msg_starting dahdi
20                 busy
21                 for mod in $ZAP_MODULES; do
22                         modprobe $mod
23                 done
24                 sleep 2
25                 /usr/sbin/dahdi_cfg
26                 RETVAL=$?
27                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dahdi
28                 ok
29         else
30                 msg_already_running dahdi
31         fi
32 }
33
34 stop() {
35         # Stop daemons.
36         if [ -f /var/lock/subsys/dahdi ]; then
37                 msg_stopping dahdi
38                 busy
39                 for mod in $ZAP_MODULES; do
40                         if test x$mod != xdahdi; then
41                                 rmmod $mod
42                         fi
43                 done
44                 rmmod dahdi
45                 rm -f /var/lock/subsys/dahdi >/dev/null 2>&1
46                 ok
47         else
48                 msg_not_running dahdi
49         fi
50 }
51
52 condrestart() {
53         if [ -f /var/lock/subsys/dahdi ]; then
54                 stop
55                 start
56         else
57                 msg_not_running dahdi
58                 RETVAL=$1
59         fi
60 }
61
62 RETVAL=0
63 # See how we were called.
64 case "$1" in
65   start)
66         start
67         ;;
68   stop)
69         stop
70         ;;
71   restart)
72         stop
73         start
74         ;;
75   try-restart)
76         condrestart 0
77         ;;
78   reload|force-reload|graceful)
79         if [ -f /var/lock/subsys/dahdi ]; then
80                 /usr/sbin/dahdi_cfg
81                 RETVAL=$?
82         else
83                 msg_not_running dahdi
84                 RETVAL=7
85         fi
86         ;;
87   status)
88         RETVAL=0
89         ;;
90   *)
91         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|graceful|status}"
92         exit 3
93         ;;
94 esac
95
96 exit $RETVAL
This page took 0.102546 seconds and 3 git commands to generate.