Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: Use the time in a script? Message-ID: <1990Sep28.014041.15499@virtech.uucp> Date: 28 Sep 90 01:40:41 GMT References: <14183@hydra.gatech.EDU> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 23 In article <14183@hydra.gatech.EDU> ce1zzes@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