📄 updatehosts
字号:
#!/bin/sh# @(#) updatehosts 1.9 92/08/31 @(#)## update the host tables and DNS files## arguments are the files to edit## Copyright (c) 1992 by Texas Internet Consulting# This code may be freely copied and used so long as this# copyright notice is attached. This code may not be sold# without the express written permission of Texas Internet Consulting.# Texas Internet Consulting makes no warranty as to the correctness# nor the applicability of this code for any purpose.EDITOR=${EDITOR-vi}DNS_PARAMETERS=${DNS_PARAMETERS-dns_parameters}NAMED_DIR=${NAMED_DIR-/etc/named}cd ${NAMED_DIR}# if no arguments display optionsif [ $# -eq 0 ]; then echo "Usage: -u | file..." exit 1fi# shift off the update option and proceedif [ "$1" = "-u" ]; then shiftfi# set umask to group read and writeumask 2# check if the files exist and are under SCCS control and are readableokay=1for i do if [ ! -f SCCS/s.$i ]; then echo "file $i is not under SCCS control" okay=0 elif [ ! -r SCCS/s.$i ]; then echo "file $i is not readable by you" okay=0 elif [ -f SCCS/p.$i ]; then echo "file $i is already checked out under SCCS" okay=0 elif [ -f $i ]; then rm -f $i fidoneif [ $okay -eq 0 ]; then exit 1fi# checkout and edit the filesfor i do sccs edit $i $EDITOR $i sccs delget $idone# update the serial filesccs edit serial >/dev/null 2>&1sccs delget -s -y "" serial# generate the static tablesecho "generating static hosts table..."genstatic# generate the dns mapecho "generating the DNS database..."gendnspoke_ns reload
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -