1 |
brianr |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
|
|
# Init file for DansGuardian content filter. |
4 |
|
|
# |
5 |
|
|
# Written by Dag Wieers <dag@wieers.com>. |
6 |
|
|
# |
7 |
|
|
# chkconfig: - 92 8 |
8 |
|
|
# description: DansGuardian content filter. |
9 |
|
|
# |
10 |
|
|
# processname: dansguardian |
11 |
|
|
# config: /etc/dansguardian/dansguardian.conf |
12 |
|
|
# pidfile: /var/run/dansguardian |
13 |
|
|
|
14 |
|
|
source /etc/init.d/functions |
15 |
|
|
source /etc/sysconfig/network |
16 |
|
|
|
17 |
|
|
### Check that networking is up. |
18 |
|
|
[ "${NETWORKING}" == "no" ] && exit 0 |
19 |
|
|
|
20 |
|
|
[ -x "/usr/sbin/dansguardian" ] || exit 1 |
21 |
|
|
[ -r "/etc/dansguardian/dansguardian.conf" ] || exit 1 |
22 |
|
|
|
23 |
|
|
RETVAL=0 |
24 |
|
|
prog="dansguardian" |
25 |
|
|
desc="Web Content Filter" |
26 |
|
|
|
27 |
|
|
start() { |
28 |
|
|
echo -n $"Starting $desc ($prog): " |
29 |
|
|
daemon $prog |
30 |
|
|
RETVAL=$? |
31 |
|
|
echo |
32 |
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dansguardian |
33 |
|
|
return $RETVAL |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
stop() { |
37 |
|
|
echo -n $"Shutting down $desc ($prog): " |
38 |
|
|
killproc $prog |
39 |
|
|
RETVAL=$? |
40 |
|
|
echo |
41 |
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dansguardian |
42 |
|
|
return $RETVAL |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
restart() { |
46 |
|
|
stop |
47 |
|
|
start |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
reload() { |
51 |
|
|
echo -n $"Reloading $desc ($prog): " |
52 |
|
|
killproc $prog -HUP |
53 |
|
|
RETVAL=$? |
54 |
|
|
echo |
55 |
|
|
return $RETVAL |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
case "$1" in |
59 |
|
|
start) |
60 |
|
|
start |
61 |
|
|
;; |
62 |
|
|
stop) |
63 |
|
|
stop |
64 |
|
|
;; |
65 |
|
|
restart) |
66 |
|
|
restart |
67 |
|
|
;; |
68 |
|
|
reload) |
69 |
|
|
reload |
70 |
|
|
;; |
71 |
|
|
condrestart) |
72 |
|
|
[ -e /var/lock/subsys/dansguardian ] && restart |
73 |
|
|
RETVAL=$? |
74 |
|
|
;; |
75 |
|
|
status) |
76 |
|
|
status $prog |
77 |
|
|
RETVAL=$? |
78 |
|
|
;; |
79 |
|
|
*) |
80 |
|
|
echo $"Usage: $0 {start|stop|restart|condrestart|status}" |
81 |
|
|
RETVAL=1 |
82 |
|
|
esac |
83 |
|
|
|
84 |
|
|
exit $RETVAL |