All you have to do is escape the '%' which has special meaning in
crontab:
date "+\%H"
should work fine.
>From 'man 5 crontab':
The "sixth" field (the rest of the line) specifies the command
to be run. The entire command portion of the
line, up to a newline or % character, will be executed by /bin/sh
or by the shell specified in the SHELL vari-
able of the cronfile. Percent-signs (%) in the command,
unless escaped with backslash (\), will be changed
into newline characters, and all data after the first % will be
sent to the command as standard input.
Kevin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Tim
Sent: Thursday, February 04, 2010 2:48 PM
To: Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list
Subject: Re: [rhelv5-list] scheduling issue
On 02/05/2010 06:44 AM, Kinzel, David wrote:
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> [email protected]
>
>> I apologize, I should have taken an extra minute to re-read my
> message. I
>> am trying to work with timezones and cron together. IE Server is on
> CST,
>> needs to run reports at 4pm in EST, CST, MST, and PST.
>>
>
> Is there reason why 0 * * * * [ `TZ=CST date "+%H"` -eq 16 ]&&
(myjob)
> would not
> satisfy your needs -- it's not a super clean solution but it does work
> and should be easy to maintain.
It's worth noting that `date +%` doesn't work in cron. You'll have to
put it in a script then call the script via cron.
--
Tim
_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list
_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list