From 723b98f5494c23fe7bcf021ef4024887c24e4122 Mon Sep 17 00:00:00 2001 From: short <> Date: Tue, 24 Jul 2001 18:31:39 +0000 Subject: [PATCH 1/1] Script for auto-update of "kratochvil.vellum.cz" DNS zone from UPC client --- bin/kratochvil.vellum.cz-update | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 bin/kratochvil.vellum.cz-update diff --git a/bin/kratochvil.vellum.cz-update b/bin/kratochvil.vellum.cz-update new file mode 100755 index 0000000..c32a5b4 --- /dev/null +++ b/bin/kratochvil.vellum.cz-update @@ -0,0 +1,25 @@ +#! /bin/sh + +lockfile="/home/short/bin/kratochvil.vellum.cz-update.lock" +kratochvil_IP="`echo "$SSH_CLIENT"|cut -d ' ' -f 1`" +kratochvil_IP_back="`echo "$kratochvil_IP"|sed 's/\./\\\\./g'`" +named_dir="/etc/named" +cf_file="$named_dir/cf/kratochvil.vellum.cz" + +if [ -f "$lockfile" ];then lockmsg=true;else lockmsg=false;fi +if $lockmsg;then echo -n "$0: Locking \"$lockfile\"...";fi +lockfile -l 60 "$lockfile" +trap 'rm -f "$lockfile"' EXIT +if $lockmsg;then echo " done.";fi + +if grep -q '^ `'"$kratochvil_IP_back'"'$' "$cf_file";then + echo "$0: Nothing to do, $kratochvil_IP already present." + exit 0 + fi + +echo "$0: Updating new IP $kratochvil_IP..." +echo -e '%s#\(^ `\)[0-9.]*\('"'"'\)$#\\1'"$kratochvil_IP"'\\2#\nw'|ed -s "$cf_file" +make -C "$named_dir" --assume-new="ver/.version" +/home/short/secure/ndc-reload-short +echo "$0: Update done." +exit 0 -- 1.8.3.1