summaryrefslogtreecommitdiffstats
path: root/network/ike/rc.iked
blob: c80894fee64caa3310dcdd70717fd97efa1aaa1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
#
# /etc/rc.d/rc.iked
#
# Start/stop/restart the Shrew Soft IKE daemon.
#

# Start iked:
iked_start() {
  if [ -x /usr/sbin/iked ]; then
    echo "Starting the Shrew Soft IKE daemon: /usr/sbin/iked"

    if [ -z "$(/sbin/lsmod | grep "^tun ")" ]; then
      /sbin/modprobe tun
    fi

    /usr/sbin/iked
  fi
}

# Stop iked:
iked_stop() {
  killall iked
}

# Restart iked:
iked_restart() {
  iked_stop
  sleep 1
  iked_start
}

case "$1" in
'start')
  iked_start
  ;;
'stop')
  iked_stop
  ;;
'restart')
  iked_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac