updated on Sun Jan 15 16:02:00 UTC 2012
[aur-mirror.git] / shrew-vpn-client / iked
blobf9bfb319881696a2dd11952324da1b8be50f9ac1
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 get_pid() {
7 pidof iked
10 case "$1" in
11 start)
12 stat_busy "Starting iked Daemon"
14 PID=`get_pid`
15 if [ -z "$PID" ]; then
16 [ -f /var/run/iked.pid ] && rm -f /var/run/iked.pid
17 iked > /dev/null
18 if [ $? -gt 0 ]; then
19 stat_fail
20 exit 1
21 else
22 echo `get_pid` > /var/run/iked.pid
23 add_daemon iked
24 stat_done
26 else
27 stat_fail
28 exit 1
32 stop)
33 stat_busy "Stopping iked Daemon"
34 PID=`get_pid`
35 [ ! -z "$PID" ] && kill $PID &> /dev/null
36 if [ $? -gt 0 ]; then
37 stat_fail
38 exit 1
39 else
40 rm -f /var/run/iked.pid &> /dev/null
41 rm_daemon iked
42 stat_done
46 restart)
47 $0 stop
48 sleep 3
49 $0 start
52 echo "usage: $0 {start|stop|restart}"
53 esac
54 exit 0