#! /bin/sh
set -e

# /etc/init.d/iked: start and stop the Shrew Soft IKE daemon

test -x /usr/sbin/iked || exit 0

. /lib/lsb/init-functions

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in
  start)
	log_begin_msg "Starting Shrew Soft IKE daemon..."
	start-stop-daemon --start --quiet --exec /usr/sbin/iked || log_end_msg 1
	log_end_msg 0
	;;
  stop)
	log_begin_msg "Stopping Shrew Soft IKE daemon..."
	start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/iked || log_end_msg 1
	log_end_msg 0
	;;

  restart)
	log_begin_msg "Restarting Shrew Soft IKE daemon..."
	start-stop-daemon --stop --quiet --oknodo --retry 30 --exec /usr/sbin/iked || log_end_msg 1
	start-stop-daemon --start --quiet --exec /usr/sbin/iked || log_end_msg 1
	log_end_msg 0
	;;

  *)
	log_success_msg "Usage: /etc/init.d/iked {start|stop|restart}"
	exit 1
esac

exit 0
c

exit 0
