amos@taux01.UUCP (Amos Shapir) (12/22/89)
The idea of DistantBiff is to run a command agin and again until something happens; here's a shell file that can do thi with any command. Call it 'ww' to run the command until its output changes, and link to 'wu' to run until its output stops changing. I have found it very useful. Flags: -t time - run every 'time' seconds (default 60) -v - view output of each iteration (obviously only useful to 'wu') -x [time] - run on 'time' seconds after the exact time (i.e. -t 3600 -x 1200 runs the command on the hour+20 mins.) o / o / o / o / --Cut-here-------X---------------X---------------X---------------X---- o \ o \ o \ o \ : wait while/until case $0 in *u) r='!='; o=x;; *w) r='=';; esac intrval=60 for i do case $i in -t) intrval=$2; shift;; -v) view=$i; shift;; -x) case "$2" in [0-9]*) exact=$2;; *) exact=0;; esac shift;; [0-9]*) shift;; *) break;; esac done cmd="$@" n=`eval "$cmd"` o="$n"$o echo "$n" while [ "$n" $r "$o" ] do slp=$intrval case $exact in ?*) d=`date` slp=`expr $intrval - \( \( "$d" : '.*\(..\):..:' \* 60 \ + "$d" : '.*:\(..\):' \) \* 60 + "$d" : '.*:..:\(..\)' \) \ % $intrval + $exact` esac sleep $slp o="$n" n=`eval "$cmd"` case $view in -v) echo "$n";; esac done case $view in -v) : ;; *) echo "$n";; esac echo -n o / o / o / o / --Cut-here-------X---------------X---------------X---------------X---- o \ o \ o \ o \ May the Source be with you, always... -- Amos Shapir amos@taux01.nsc.com, amos@nsc.nsc.com National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel Tel. +972 52 522261 TWX: 33691, fax: +972-52-558322 GEO: 34 48 E / 32 10 N