#
### BEGIN INIT INFO
# Provides: openvswitch-ipsec
-# Required-Start: $network $local_fs $remote_fs
+# Required-Start: $network $local_fs $remote_fs openvswitch-switch
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Open vSwitch GRE-over-IPsec daemon
+# Description: The ovs-monitor-ipsec script provides support for
+# encrypting GRE tunnels with IPsec.
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/share/openvswitch/scripts/ovs-monitor-ipsec # Daemon's location
NAME=ovs-monitor-ipsec # Introduce the short server's name here
LOGDIR=/var/log/openvswitch # Log directory to use
+DATADIR=/usr/share/openvswitch
-PIDFILE=/var/run/openvswitch/$NAME.pid
+PIDFILE=/var/run/openvswitch/$NAME.pid
test -x $DAEMON || exit 0
# If this value is set too low you might not
# let some servers to die gracefully and
# 'restart' will not work
-
+
set -e
running_pid() {
# Check if a given process pid's cmdline matches a given name
pid=$1
name=$2
- [ -z "$pid" ] && return 1
+ [ -z "$pid" ] && return 1
[ ! -d /proc/$pid ] && return 1
cmd=`cat /proc/$pid/cmdline | tr "\000" " "|cut -d " " -f 2`
# Is this the expected server
}
start_server() {
- if [ ! -d /var/run/openvswitch ]; then
- install -d -m 755 -o root -g root /var/run/openvswitch
- fi
-
- /usr/share/openvswitch/scripts/ovs-monitor-ipsec \
- --pidfile=$PIDFILE --log-file --detach --monitor \
- unix:/var/run/openvswitch/db.sock
-
+ ${DATADIR}/scripts/ovs-ctl --ike-daemon=strongswan start-ovs-ipsec
return 0
}
stop_server() {
- if [ -e $PIDFILE ]; then
- kill `cat $PIDFILE`
- fi
-
+ ${DATADIR}/scripts/ovs-ctl stop-ovs-ipsec
return 0
}
;;
# Use this if the daemon cannot reload
reload)
- log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
- log_warning_msg "cannot re-read the config file (use restart)."
+ log_warning_msg "Reloading $NAME daemon: not implemented, as the"
+ log_warning_msg "deamon cannot re-read the config file (use restart)."
;;
*)
N=/etc/init.d/openvswitch-ipsec
- echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
+ echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" \
+ >&2
exit 1
;;
esac