#!/bin/sh SLEEP=10 MAX=0 SLEEP_CMD="sleep" Usage=" $0 cmd options -c -s, -n -m " # Process args: while [ "$1" != "" ] do case $1 in "-c"*) shift; MAX="$1"; ;; "-s"*) shift; SLEEP="$1"; ;; "-m"*) shift; if type usleep > /dev/null 2>&1; then SLEEP="`expr $1 \* 1000`"; SLEEP_CMD="usleep" else SLEEP="$1"; SLEEP_CMD="msleep" fi ;; "-n"*) shift; SLEEP="$1"; ;; "-h"*) echo "$Usage"; exit 0; ;; *) break ;; esac shift done cnt=0; while [ 1 ] do cnt=`expr $cnt + 1` if [ "$1" != "" ]; then eval $* else date; uptime fi if [ "$MAX" != "0" -a $cnt -gt $MAX ] ; then echo "exiting after $MAX loops." break; fi $SLEEP_CMD $SLEEP done exit 0