diff options
-rwxr-xr-x | localnsrequest | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/localnsrequest b/localnsrequest new file mode 100755 index 0000000..30834c5 --- /dev/null +++ b/localnsrequest @@ -0,0 +1,104 @@ +#!/bin/sh + +prg=$(basename $0) +copyright="(C) 2002 Jonas Smedegaard <dr@jones.dk>" + +usage="$prg, $copyright + +Usage: $prg <handle> reg|redel <domain> [<otherdomain.dk> ...]" + +if [ $# \< 3 ]; then + echo "Too few parameters!" + echo + echo "$usage" + exit 1 +fi +handle=$1 +shift +action=$1 +shift + +if [ -z "$handle" ]; then + echo "Error: Missing handle!" + echo + echo "$usage" + exit 1 +fi + +case $action in + reg) + file=domain.3.00.dansk.txt-$handle + ;; + redel) + file=redelegation.3.00.dansk.txt-$handle + ;; + *) + echo "Unsupported action: \"$action\"!" + echo + echo "$usage" + exit 1 + ;; +esac + +if [ ! -f $dir/$file ]; then + echo "Error: File \"$dir/$file\" doesn't exist!" + echo "Did you use a valid handle?" + echo + echo "$usage" + exit 1 +fi + +BCC="" +[ -n "$EMAIL" ] && BCC="-c $EMAIL" + +for DOMAIN in $@; do + case $DOMAIN in + *.dk) + dir='/etc/local-COMMON/DK-Hostmaster' + TO="hostmaster@dk-hostmaster.dk" + case $action in + reg) + file=domain.3.00.dansk.txt-$handle + ;; + redel) + file=redelegation.3.00.dansk.txt-$handle + ;; + *) + echo "Unsupported action: \"$action\"!" + echo + echo "$usage" + exit 1 + ;; + esac + sed -e "s/{DOMAIN}/$DOMAIN/g" $dir/$file \ + | mail -s "$action $DOMAIN ($handle)" -a "Content-Type: TEXT/PLAIN; charset=ISO-8859-1" $BCC -e $TO + ;; + *.com|*.org|*.net) + dir='/etc/local-COMMON/TotalRegistrations' + TO="register@totalregistrations.com" + file=email-$handle + case $action in + reg) + ACTION=N + ;; + redel) + ACTION=T + ;; + *) + echo "Unsupported action: \"$action\"!" + echo + echo "$usage" + exit 1 + ;; + esac + sed -e "s/{DOMAIN}/$DOMAIN/g" -e "s/{ACTION}/$ACTION/g" -e "s/{PASSWD}/$PASSWD/g" $dir/$file \ + | mail -s "$action $DOMAIN ($handle)" -a "Content-Type: TEXT/PLAIN; charset=ISO-8859-1" $BCC -e $TO + ;; + *) + echo "Unsupported domain: \"$DOMAIN\"!" + echo + echo "$usage" + exit 1 + ;; + esac +done |