3 # System startup script for tinc
4 # $Id: init.d,v 1.14.2.3 2000/10/31 16:22:49 guus Exp $
6 # Based on Lubomir Bulej's Redhat init script.
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
14 my $DAEMON="/usr/sbin/tincd";
16 my $DESC="tinc daemons";
17 my $TCONF="/etc/tinc";
19 my $NETSFILE="$TCONF/nets.boot";
23 if (! -f $DAEMON) { exit 0; }
28 if(! open(FH, $NETSFILE)) {
29 warn "Please create $NETSFILE.\n";
34 if( /^[ ]*([^ \#]+)/i ) {
39 warn "$NETSFILE doesn't contain any nets.\n";
45 if(!defined($ARGV[0])) {
46 die "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}\n";
49 if($ARGV[0] eq "start") {
51 print "Starting $DESC:";
54 system("$DAEMON -n $_[0] $EXTRA");
57 } elsif ($ARGV[0] eq "stop") {
59 print "Stopping $DESC:";
62 system("$DAEMON -n $_[0] $EXTRA -k");
65 } elsif ($ARGV[0] eq "restart" || $ARGV[0] eq "force-reload") {
67 print "Stopping $DESC:";
70 system("$DAEMON -n $_[0] $EXTRA -k");
73 print "Starting $DESC:";
76 system("$DAEMON -n $_[0] $EXTRA");
80 die "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}\n";