Use the time in a script?

Conor P. Cahill cpcahil at virtech.uucp
Fri Sep 28 11:40:41 AEST 1990


In article <14183 at hydra.gatech.EDU> ce1zzes at prism.gatech.EDU (Eric Sheppard) writes:
>I would like to make sure that a script or program is not executed during
>a certain period of every hour.  Is there an elegant method to achieve this,
>short of an additional C program?

How about by using the date(1) command.  The following shell will exit
if it is between 10 and 15 minutes past the hour (inclusive).

	start=10
	end=15
	time=`date +%M`

	if [ $time -ge $start -a $time -le $end ]; then
		echo "you can't do this now"
		exit
	fi

	echo ok to run

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 



More information about the Comp.unix.questions mailing list