: ########################################################################## # Shellscript: periodic - periodically execute command # Version : 0.1 (beta) # Author : Heiner Steven (heiner.steven@odn.de) # Date : 03-03-95 # SCCS-Id. : $Id: periodic,v 1.1.1.1 1999/06/15 19:29:05 heiner Exp $ ########################################################################## # Description # ########################################################################## PN=`basename $0` # program name VER='0.1 (beta)' DefInterval=5 Usage () { echo "$PN - periodically execute command, $VER (stv '95) usage: $PN [-t seconds] command [argument ...] -t: interval length (in seconds, default is $DefInterval s)" >&2 exit 1 } set -- `getopt t:h "$@"` while [ $# -gt 0 ] do case "$1" in -t) Interval="$2"; shift;; --) shift; break;; -h) Usage;; -*) Usage;; *) break;; # Command name esac shift done [ $# -lt 1 ] && Usage eval "$@" while sleep ${Interval:=$DefInterval} do eval "$@" done