Summary: simple (?) script help

From: Gosselin, Mark <>
Date: Wed Mar 03 2004 - 12:13:38 EST
Thanks to everyone who responded (and there were a ton of you).

My situation doesn't lend itself to two different cron jobs all that well, so
I used a combination of suggestions to get a script that looks something like


MINS=`date "+%M"` ; export MINS
echo $MINS
HR=`date "+%H"` ; export HR
echo $HR
 if [ "${MINS}" -eq 00 ]
        # 0 minutes
        if ( $HR == 00 || 06 || 12 || 18 ) then
        echo Checked hour
          else   # any other hour
        echo Not an hour divisible by 6
          else   # any other hour
        echo Not an hour divisible by 6
        # any other minute


Mark Gosselin
NetScout Systems


Original Post:

Hi all,

I'm writing a script and am having a mental block with respect to one
of it....

Here's the scenario:

I run a cronjob that performs a certain task every 5 minutes.... I need to
continue doing that, but at specified times (say midnight, 6am, noon, and
6pm), I want to do a separate task...

What I'm looking for is a good way to parse the output of the 'date'
so that I can look at the minute. If the minutes are equal to 00, then I
to look at the hour and see if it equals 00, 06, 12, or 18...

Anyone got an easy way to do this???

All help is most welcome.

Mark Gosselin
NetScout Systems
sunmanagers mailing list
sunmanagers mailing list
Received on Wed Mar 3 12:13:21 2004

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:26 EST