]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ######################################################################## | |
3 | # Begin $rc_base/init.d/guardian | |
4 | # | |
5 | # Description : Guardian Initscript | |
6 | # | |
7 | # Authors : Kim Wölfel for ipfire.org | |
8 | # | |
9 | # Version : 01.00 | |
10 | # | |
11 | # Notes : | |
12 | # | |
13 | ######################################################################## | |
14 | ||
15 | . /etc/sysconfig/rc | |
16 | . ${rc_functions} | |
17 | ||
18 | eval $(/usr/local/bin/readhash /var/ipfire/guardian/settings) | |
19 | ||
20 | function guardian_is_enabled() { | |
21 | [ "${GUARDIAN_ENABLED}" = "on" ] | |
22 | } | |
23 | ||
24 | case "$1" in | |
25 | start) | |
26 | guardian_is_enabled || exit 0 | |
27 | ||
28 | boot_mesg "Starting Guardian..." | |
29 | loadproc /usr/sbin/guardian -c /var/ipfire/guardian/guardian.conf | |
30 | ;; | |
31 | ||
32 | stop) | |
33 | if ([ -f /run/guardian/guardian.pid ]); then | |
34 | boot_mesg "Stopping Guardian..." | |
35 | kill $(cat /run/guardian/guardian.pid) | |
36 | sleep 1; | |
37 | fi | |
38 | ;; | |
39 | ||
40 | status) | |
41 | statusproc /usr/sbin/guardian | |
42 | ;; | |
43 | ||
44 | restart) | |
45 | $0 stop | |
46 | sleep 2 | |
47 | $0 start | |
48 | ;; | |
49 | ||
50 | *) | |
51 | echo "Usage: $0 {start|stop|restart|status}" | |
52 | exit 1 | |
53 | ;; | |
54 | esac | |
55 | ||
56 | # End $rc_base/init.d/guardian |