diff options
author | Jonas Smedegaard <dr@jones.dk> | 2002-08-08 15:38:59 +0000 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2002-08-08 15:38:59 +0000 |
commit | 913e0a786f06c413ec5b0aa7bc77a7be26dc01b7 (patch) | |
tree | 9859d53c1272a72d9df239185775c1bded4357b9 /localnsrequest | |
parent | 69665b42af5a989b4b88b79d1cc3160c9f4e2cd7 (diff) |
Rewrite localnsrequest-dk to support TotalRegistrations and rename to localnsrequest.
Diffstat (limited to 'localnsrequest')
-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 |