#!/usr/bin/sh # 2000.07.31 David Fischer # # This script is meant to be called periodically by the cron function but can # be run from the command line. Note, it currently automatically updates # the crontab file. If you already use the crontab file, you need to modify # this script or your current crontab settings will be lost! # # The arguments for DNWatcher tell it the current day of the year, the number of # days between "Still Alive" messages, the notification email address, and then # the domain names to watch. When called, it checks each of the domain names via "whois". # If the "whois" output contains "No match", a message stating that domain name is available # is emailed to the notification address. If the given number of days have passed since # the current date, a "Still alive" message is emailed, as a reminder, stating which # domain names are being monitored. Finally, it updates the crontab file with the current # day, and exits. # # Use the crontab to run this automatically with # desired Domain names as arguments # setenv EDITOR emacs # crontab -e # (don't enter this...) # (enter this sort of thing) 5 0,6,12,18,21 * * * dnwatcher 0 1 fischer fischer.com fischer.net # (...or this) days between "still alive" emails # The above runs it 5 minutes past midnight, 6am, noon, 6pm, and 9pm # every day, every month, checking the availability of # fischer.com fischer.net. Every day, it send an email to fischer, # telling what domain names are being watched. Note, this will write over # your crontab file contents. If you use your crontab currently, you will # need to modify this script. (If you do, please send me the changes) # # Save this script with the name "dnwatcher" and place it in your home directory # Make it file executable by executing the command: # chmod a+x dnwatcher # PATH=/usr/local/script:/usr/local/bin:/usr/optics/script:/usr/optics/bin:/usr/hosts:./bin:.:/usr/ceas/lang/SC2.0.1:/usr/optics/insite/bin:/usr/openwin/bin:/usr/openwin/demo:/usr/ceas/script:/usr/ceas/bin:/usr/ceas/bin/X11:/usr/ucb:/home/moe/fischer/bin:/bin:/usr/bin:/usr/demo:/usr/games:/usr/new:/etc:/usr/etc:.:/usr/ceas/lib:/usr/ceas/cap:/usr/ucb:/usr/lib; export PATH arglen=`echo "$*" | wc -c | cut -c1-8` arglen=`expr $arglen - 1` day_prev=$1 day_skip=$2 addy=$3 day_now=`date +%j` day_diff=`expr $day_now - $day_prev` day_mod=`expr $day_diff % $day_skip` shift shift shift if [ $day_mod -eq 0 -a $day_diff -ne 0 ]; then #if right number of days has passed ( cat <