]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/tinc/files/init
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / tinc / files / init
1 #! /bin/sh
2 #
3 # System startup script for tinc
4 # $Id: tinc,v 1.1 2004/02/19 12:40:16 br1 Exp $
5 #
6 # Based on Lubomir Bulej's Redhat init script.
7 #
8 # Create a file $NETSFILE (/etc/tinc/nets.boot), and put all the names of
9 # the networks in there.  These names must be valid directory names under
10 # $TCONF (/etc/tinc).  Lines starting with a # will be ignored in this
11 # file.
12 #
13
14 DAEMON="/usr/sbin/tincd"
15 NAME="tinc"
16 DESC="tinc daemons"
17 TCONF="/etc/tinc"
18 EXTRA=""
19 NETSFILE="$TCONF/nets.boot"
20 NETS=""
21
22 test -f $DAEMON || exit 0
23
24 find_nets () {
25   if [ ! -f $NETSFILE ] ; then
26     echo "Please create $NETSFILE."
27     exit 0
28   fi
29   NETS="`egrep '^[ ]*[a-zA-Z0-9_]+[ ]*$' $NETSFILE`"
30 }
31
32 case "$1" in
33   start)
34     find_nets
35     echo -n "Starting $DESC:"
36     for n in $NETS ; do
37       echo -n " $n"
38       $DAEMON -n $n $EXTRA
39     done
40     echo "."
41   ;;
42   stop)
43     find_nets
44     echo -n "Stopping $DESC:"
45     for n in $NETS ; do
46       echo -n " $n"
47       $DAEMON -n $n $EXTRA -k
48     done
49     echo "."
50   ;;
51   reload)
52     find_nets
53     echo -n "Reloading $DESC configuration:"
54     for n in $NETS ; do
55       echo -n " $n"
56       $DAEMON -n $n $EXTRA -k1
57     done
58     echo "."
59   ;;
60   restart|force-reload)
61     find_nets
62     echo -n "Restarting $DESC:"
63     for n in $NETS ; do
64       echo -n " $n"
65       $DAEMON -n $n $EXTRA -k
66       sleep 1
67       $DAEMON -n $n $EXTRA
68     done
69     echo "."
70   ;;
71   *)
72     echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}"
73     exit 1
74   ;;
75 esac
76
77 exit 0