diff options
author | Frans Meulenbroeks <fransmeulenbroeks@gmail.com> | 2009-03-19 20:56:09 +0100 |
---|---|---|
committer | Frans Meulenbroeks <fransmeulenbroeks@gmail.com> | 2009-03-19 20:56:09 +0100 |
commit | 6a21d65d2840c58cfa7cd749a04669d8f7980646 (patch) | |
tree | 00b1aa153b69cda8cf9406c4700fd7730c34d3a5 /recipes/vtun/files | |
parent | dcfe7349b369a87881cf1fa43085d9e9c5609fcf (diff) | |
parent | 6f854d71c347475d53d5080a5490625345d95d12 (diff) |
Merge branch 'org.openembedded.dev' of git@git.openembedded.net:openembedded into org.openembedded.dev
Diffstat (limited to 'recipes/vtun/files')
-rw-r--r-- | recipes/vtun/files/init | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/recipes/vtun/files/init b/recipes/vtun/files/init new file mode 100644 index 0000000000..2f6ef2f6f0 --- /dev/null +++ b/recipes/vtun/files/init @@ -0,0 +1,46 @@ +#! /bin/sh + +PATH=/bin:/usr/bin:/sbin:/usr/sbin +DAEMON=/usr/sbin/vtund +CONFFILE=/etc/vtund-start.conf +PIDPREFIX=/var/run/vtund + +test -f $DAEMON || exit 0 + +case "$1" in + start) + test -d /var/lock/vtund || mkdir -p /var/lock/vtund + # find all the defined tunnels + egrep -v '^[:space:]*(#.*)?$' $CONFFILE | while true; + do + read i + # no more lines available? done, then. + if [ $? != 0 ] ; then break; fi + SARGS=`echo $i|sed -ne 's/--server--\s*/-s -P /p'`; + if [ -n "$SARGS" ]; then + echo "Starting vtund server." + start-stop-daemon -S -x $DAEMON -- $SARGS; + else + # split args into host and rest + HOST=`echo $i|cut -f 1 -d " "`; + TARGET=`echo $i|cut -f 2 -d " "`; + echo "Starting vtund client $HOST to $TARGET."; + start-stop-daemon -S -x $DAEMON -- $i; + fi + done + ;; + stop) + echo "Stopping vtund."; + killall $(basename $DAEMON); + ;; + reload|force-reload|restart) + echo "Restarting vtund."; + $0 stop || true; + $0 start; + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2 + exit 1 + ;; +esac +exit 0
\ No newline at end of file |