--- a/master_watcher Tue Dec 24 02:05:56 2002 +0000
+++ b/master_watcher Fri Jan 24 07:04:42 2003 +0000
@@ -7,6 +7,8 @@
-f --[no]follow Follow the end of the logfile [$opt_follow]
-d --[no]debug extra debug output [$opt_debug]
-h --help This text [$opt_help]
+ --daemon go into background [$opt_daemon]
+ -p --pidfile=s file to store the pid [$opt_pidfile]
#
# Es wird ein Verzeichnis geben, in diesem Verzeichnis liegt für
# *jede* Zone eine eigene Konfigurations-Datei.
@@ -52,6 +54,9 @@
"145.253.160.50" => "bastion.actech.de",
"62.144.175.34" => "ns.add-on.de",
"195.145.19.34" => "ns.datom.de",
+ "62.157.194.1" => "ns.mueritzcomp.de",
+ "212.80.235.137" => "ns.flaemingnet.de omni.flaemingnet.de",
+ "212.80.235.152" => "www.proton24.de",
# "194.162.141.17" => "dalx1.nacamar.de",
);
@@ -61,11 +66,13 @@
my %seen;
my $opt_help = 0;
+my $opt_pidfile = "/var/run/$ME.pid";
my $opt_logfile = "/var/log/syslog";
my $opt_zonesdir = "/etc/bind/zones.d";
my $opt_follow = 0;
my $opt_update = 0;
my $opt_debug = 0;
+my $opt_daemon = 0;
my $naptime = 60;
@@ -85,6 +92,8 @@
"follow!" => \$opt_follow,
"update!" => \$opt_update,
"debug!" => \$opt_debug,
+ "daemon!" => \$opt_daemon,
+ "pidfile=s" => \$opt_pidfile,
"zonesdir=s" => \$opt_zonesdir)
or die "$ME: Bad Usage\n";
@@ -94,6 +103,25 @@
}
open (LOGFILE, $_ = "<$opt_logfile") or die "Can't open $_: $!\n";
+
+ # Go Daemon
+ #if ($opt_daemon) {
+# my $pid = fork();
+# if
+# }
+
+ # Create the PID-File
+ {
+ open(PID, $_ = ">$opt_pidfile.$$") or die "Can't open $opt_pidfile: $!\n";
+ print PID "$$\n";
+ close(PID);
+
+ if (!rename($_ = "$opt_pidfile.$$", $opt_pidfile)) {
+ unlink "$opt_pidfile.$$";
+ die "There's another $ME running. Bad. Stop.";
+ }
+ }
+
for (;;) {
my (%masters, %missing, %nomasters);
while (<LOGFILE>) {