1 |
#!/bin/bash |
2 |
# |
3 |
# ircd This shell script takes care of starting and stopping |
4 |
# ircd-hybrid. |
5 |
# |
6 |
# $Id$ |
7 |
# |
8 |
# chkconfig: 2345 92 11 |
9 |
# description: ircd-hybrid is an Internet Relay Chat server |
10 |
# processname: ircd |
11 |
# config: @sysconfdir@/ircd.conf |
12 |
# pidfile: @sysconfdir@/ircd.pid |
13 |
|
14 |
# Source function library. |
15 |
. /etc/rc.d/init.d/functions |
16 |
|
17 |
# Source networking configuration. |
18 |
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network |
19 |
|
20 |
# Source ircd init configuration. |
21 |
if [ -f /etc/sysconfig/ircd ] ; then |
22 |
. /etc/sysconfig/ircd |
23 |
fi |
24 |
|
25 |
# Check that networking is up. |
26 |
[ "${NETWORKING}" = "no" ] && exit 0 |
27 |
|
28 |
RETVAL=0 |
29 |
prog="ircd" |
30 |
|
31 |
start() { |
32 |
echo -n $"Starting $prog: " |
33 |
daemon --user=ircd @bindir@/ircd $IRCD_OPTIONS |
34 |
RETVAL=$? |
35 |
echo |
36 |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ircd |
37 |
return $RETVAL |
38 |
} |
39 |
|
40 |
reload() { |
41 |
echo -n $"reloading $prog: " |
42 |
killproc ircd -HUP |
43 |
RETVAL=$? |
44 |
echo |
45 |
return $RETVAL |
46 |
} |
47 |
|
48 |
restart() { |
49 |
stop |
50 |
sleep 3 |
51 |
start |
52 |
} |
53 |
|
54 |
stop() { |
55 |
echo -n $"Shutting down $prog: " |
56 |
killproc ircd |
57 |
RETVAL=$? |
58 |
echo |
59 |
return $RETVAL |
60 |
} |
61 |
|
62 |
|
63 |
# See how we were called. |
64 |
case "$1" in |
65 |
start) |
66 |
start |
67 |
RETVAL=$? |
68 |
;; |
69 |
stop) |
70 |
stop |
71 |
RETVAL=$? |
72 |
;; |
73 |
reload) |
74 |
reload |
75 |
RETVAL=$? |
76 |
;; |
77 |
restart) |
78 |
stop |
79 |
start |
80 |
RETVAL=$? |
81 |
;; |
82 |
condrestart) |
83 |
if [ -f /var/lock/subsys/ircd ]; then |
84 |
stop |
85 |
start |
86 |
RETVAL=$? |
87 |
fi |
88 |
;; |
89 |
status) |
90 |
status ircd |
91 |
RETVAL=$? |
92 |
;; |
93 |
*) |
94 |
echo $"Usage: $0 {start|stop|restart|condrestart|status}" |
95 |
exit 1 |
96 |
esac |
97 |
|
98 |
exit $RETVAL |