summaryrefslogtreecommitdiff
path: root/localnsrequest
blob: 30834c5315525ebc043db46c9f051aa5d088a570 (plain)
  1. #!/bin/sh
  2. prg=$(basename $0)
  3. copyright="(C) 2002 Jonas Smedegaard <dr@jones.dk>"
  4. usage="$prg, $copyright
  5. Usage: $prg <handle> reg|redel <domain> [<otherdomain.dk> ...]"
  6. if [ $# \< 3 ]; then
  7. echo "Too few parameters!"
  8. echo
  9. echo "$usage"
  10. exit 1
  11. fi
  12. handle=$1
  13. shift
  14. action=$1
  15. shift
  16. if [ -z "$handle" ]; then
  17. echo "Error: Missing handle!"
  18. echo
  19. echo "$usage"
  20. exit 1
  21. fi
  22. case $action in
  23. reg)
  24. file=domain.3.00.dansk.txt-$handle
  25. ;;
  26. redel)
  27. file=redelegation.3.00.dansk.txt-$handle
  28. ;;
  29. *)
  30. echo "Unsupported action: \"$action\"!"
  31. echo
  32. echo "$usage"
  33. exit 1
  34. ;;
  35. esac
  36. if [ ! -f $dir/$file ]; then
  37. echo "Error: File \"$dir/$file\" doesn't exist!"
  38. echo "Did you use a valid handle?"
  39. echo
  40. echo "$usage"
  41. exit 1
  42. fi
  43. BCC=""
  44. [ -n "$EMAIL" ] && BCC="-c $EMAIL"
  45. for DOMAIN in $@; do
  46. case $DOMAIN in
  47. *.dk)
  48. dir='/etc/local-COMMON/DK-Hostmaster'
  49. TO="hostmaster@dk-hostmaster.dk"
  50. case $action in
  51. reg)
  52. file=domain.3.00.dansk.txt-$handle
  53. ;;
  54. redel)
  55. file=redelegation.3.00.dansk.txt-$handle
  56. ;;
  57. *)
  58. echo "Unsupported action: \"$action\"!"
  59. echo
  60. echo "$usage"
  61. exit 1
  62. ;;
  63. esac
  64. sed -e "s/{DOMAIN}/$DOMAIN/g" $dir/$file \
  65. | mail -s "$action $DOMAIN ($handle)" -a "Content-Type: TEXT/PLAIN; charset=ISO-8859-1" $BCC -e $TO
  66. ;;
  67. *.com|*.org|*.net)
  68. dir='/etc/local-COMMON/TotalRegistrations'
  69. TO="register@totalregistrations.com"
  70. file=email-$handle
  71. case $action in
  72. reg)
  73. ACTION=N
  74. ;;
  75. redel)
  76. ACTION=T
  77. ;;
  78. *)
  79. echo "Unsupported action: \"$action\"!"
  80. echo
  81. echo "$usage"
  82. exit 1
  83. ;;
  84. esac
  85. sed -e "s/{DOMAIN}/$DOMAIN/g" -e "s/{ACTION}/$ACTION/g" -e "s/{PASSWD}/$PASSWD/g" $dir/$file \
  86. | mail -s "$action $DOMAIN ($handle)" -a "Content-Type: TEXT/PLAIN; charset=ISO-8859-1" $BCC -e $TO
  87. ;;
  88. *)
  89. echo "Unsupported domain: \"$DOMAIN\"!"
  90. echo
  91. echo "$usage"
  92. exit 1
  93. ;;
  94. esac
  95. done