Use the time in a script?

Randal Schwartz merlyn at iwarp.intel.com
Fri Sep 28 03:30:58 AEST 1990


In article <14183 at hydra.gatech.EDU>, ce1zzes at prism (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?

If you can blow off the positional args:

set -- `date`
case $4 in
	*:0[0-4]:* )
		echo "Bad time to run this"
		exit 1;;
esac

If you can't, you'll need to save and restore them, or run this in a
subshell (within parens) and check the exit status.

Just another sh hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/



More information about the Comp.unix.questions mailing list