]>
Commit | Line | Data |
---|---|---|
12c022f9 | 1 | #!/bin/sh |
2 | # | |
3 | # ircd This shell script takes care of starting and stopping ircd. | |
4 | # | |
5 | # chkconfig: 234 75 30 | |
6 | # description: Internet Relay Chat Server. | |
7 | # | |
8 | ||
9 | # Source function library. | |
10 | . /etc/rc.d/init.d/functions | |
11 | ||
12 | # Source networking configuration. | |
13 | . /etc/sysconfig/network | |
14 | ||
15 | # Get service config | |
16 | [ -f /etc/sysconfig/ircd ] && . /etc/sysconfig/ircd | |
17 | ||
18 | # Check that networking is up. | |
19 | if is_yes "${NETWORKING}"; then | |
20 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
21 | msg_network_down bIRCd | |
22 | exit 1 | |
23 | fi | |
24 | else | |
25 | exit 0 | |
26 | fi | |
27 | ||
28 | IRCD="/usr/sbin/ircd" | |
29 | ||
30 | RETVAL=0 | |
31 | # See how we were called. | |
32 | case "$1" in | |
33 | start) | |
34 | # Check if the service is already running? | |
35 | if [ ! -f /var/lock/subsys/ircd ]; then | |
36 | # Start daemons. | |
37 | msg_starting "bIRCd Server" | |
38 | daemon ${IRCD} | |
39 | touch /var/lock/subsys/ircd | |
40 | else | |
41 | msg_already_running bIRCd | |
42 | fi | |
43 | ;; | |
44 | stop) | |
45 | # Check if the service is already running? | |
46 | if [ -f /var/lock/subsys/ircd ]; then | |
47 | # Stop daemons. | |
48 | msg_stopping "bIRCd Server" | |
49 | killproc ${IRCD#\-} | |
50 | rm -f /var/lib/ircd/ircd.pid | |
51 | rm -f /var/lock/subsys/ircd | |
52 | else | |
53 | msg_not_running bIRCd | |
54 | fi | |
55 | ;; | |
56 | reload|force-reload) | |
57 | if [ -f /var/lock/subsys/ircd ]; then | |
58 | msg_reloading "bIRCd Server" | |
59 | killproc ${IRCD#\-} -HUP | |
60 | RETVAL=$? | |
61 | else | |
62 | msg_not_running bIRCd >&2 | |
63 | exit 7 | |
64 | fi | |
65 | ;; | |
66 | restart) | |
67 | $0 stop | |
68 | $0 start | |
69 | exit $? | |
70 | ;; | |
71 | status) | |
72 | status ${IRCD#\-} | |
73 | exit $? | |
74 | ;; | |
75 | *) | |
76 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" | |
77 | exit 3 | |
78 | esac | |
79 | ||
80 | exit $RETVAL |