Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / contrib / scripts / nanny.pl
blobc1e892997c0bb2c833e30fd8a184a65959f9b47d
1 #!/usr/bin/perl
3 # Copyright (C) 2004, 2007, 2012, 2014 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2000, 2001 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
18 # Id: nanny.pl,v 1.11 2007/06/19 23:47:07 tbox Exp
20 # A simple nanny to make sure named stays running.
22 $pid_file_location = '/var/run/named.pid';
23 $nameserver_location = 'localhost';
24 $dig_program = 'dig';
25 $named_program = 'named';
27 fork() && exit();
29 for (;;) {
30 $pid = 0;
31 open(FILE, $pid_file_location) || goto restart;
32 $pid = <FILE>;
33 close(FILE);
34 chomp($pid);
36 $res = kill 0, $pid;
38 goto restart if ($res == 0);
40 $dig_command =
41 "$dig_program +short . \@$nameserver_location > /dev/null";
42 $return = system($dig_command);
43 goto restart if ($return == 9);
45 sleep 30;
46 next;
48 restart:
49 if ($pid != 0) {
50 kill 15, $pid;
51 sleep 30;
53 system ($named_program);
54 sleep 120;