Merge from vendor branch GCC:
[games.git] / etc / namedb / getroot
1 #!/bin/tcsh -f
2 #
3 # If you are running named and using root.zone as a master, the root.zone
4 # file should be updated periodicly from ftp.rs.internic.net.
5 #
6 # $DragonFly: src/etc/namedb/getroot,v 1.1 2004/05/27 18:15:40 dillon Exp $
7
8 umask 027
9
10 set hostname = 'ftp.rs.internic.net'
11 set remfile = domain/root.zone.gz
12 set locfile = root.zone.gz
13 set path = ( /bin /usr/bin /sbin /usr/sbin )
14
15 fetch ftp://${hostname}:/${remfile}
16 if ( $status != 0) then
17     rm -f ${locfile}
18     echo "Download failed"
19 else
20     gunzip < ${locfile} > root.zone.new
21     if ( $status == 0 ) then
22         rm -f ${locfile}
23         if ( -f root.zone ) then
24             mv -f root.zone root.zone.bak
25         endif
26         chmod 644 root.zone.new
27         mv -f root.zone.new root.zone
28         echo "Download succeeded, restarting named"
29         rndc reload
30         sleep 1
31         rndc status
32     else
33         echo "Download failed: gunzip returned an error"
34         rm -f ${locfile}
35     endif
36 endif
37