1 |
#!/bin/sh |
2 |
# |
3 |
# racoon: This script start/stop the racoon deamon |
4 |
# |
5 |
# chkconfig: 345 11 89 |
6 |
# description: This script start/stop the racoon deamon for ipsec |
7 |
# processname: racoon |
8 |
# config: /etc/racoon/racoon.conf |
9 |
|
10 |
### BEGIN INIT INFO |
11 |
# Provides: racoon |
12 |
# Required-Start: $network |
13 |
# Requires-Stop: $network |
14 |
# Default-Start: 3 4 5 |
15 |
# Short-Description: The racoon daemon |
16 |
# Description: racoon uses the IKE (ISAKMP/Oakley) key management protocol to |
17 |
# establish security associations with other hosts. |
18 |
### END INIT INFO |
19 |
|
20 |
|
21 |
. /etc/init.d/functions |
22 |
|
23 |
RACOON_CONFIG="/etc/racoon/racoon.conf" |
24 |
|
25 |
if [ ! -f $RACOON_CONFIG ]; then |
26 |
exit 0 |
27 |
fi |
28 |
|
29 |
if [ -f /etc/sysconfig/racoon ]; then |
30 |
. /etc/sysconfig/racoon |
31 |
fi |
32 |
|
33 |
RETVAL=0 |
34 |
|
35 |
function racoon_start() { |
36 |
gprintf "Starting %s:" "racoon" |
37 |
daemon racoon $RACOON_EXTRA_OPTIONS |
38 |
RETVAL=$? |
39 |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/racoon |
40 |
echo |
41 |
return $RETVAL |
42 |
} |
43 |
|
44 |
function racoon_stop() { |
45 |
gprintf "Stopping %s:" "racoon" |
46 |
killproc racoon |
47 |
RETVAL=$? |
48 |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/racoon |
49 |
echo |
50 |
return $RETVAL |
51 |
} |
52 |
|
53 |
case "$1" in |
54 |
start) |
55 |
racoon_start |
56 |
RETVAL=$? |
57 |
;; |
58 |
stop) |
59 |
racoon_stop |
60 |
RETVAL=$? |
61 |
;; |
62 |
status) |
63 |
status racoon |
64 |
RETVAL=$? |
65 |
;; |
66 |
restart) |
67 |
racoon_stop |
68 |
racoon_start |
69 |
RETVAL=$? |
70 |
;; |
71 |
condrestart) |
72 |
if [ -f /var/lock/subsys/racoon ]; then |
73 |
racoon_stop |
74 |
racoon_start |
75 |
RETVAL=$? |
76 |
fi |
77 |
;; |
78 |
*) |
79 |
gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" "$0" |
80 |
RETVAL=1 |
81 |
esac |
82 |
|
83 |
exit $RETVAL |