cronjobs
Ed Kapitein
ed at kapitein.org
Sun May 31 01:21:01 CEST 2009
Alexey Feldgendler wrote:
> On Fri, 29 May 2009 15:49:27 +0200, Ed Kapitein <ed at kapitein.org> wrote:
>
>
>
>> i need a script/program that will read a crontab line
>> ( * * * * * some_action) and output the date and time the job will run.
>>
>> Does anyone know of such a tool?
>> This way i can un-suspend the FR a few seconds prior to the start of
>> that cron job.
>>
>> I already made a script that sort of works, but it is limmited at best
>> and i hate to reinvent the wheel again.
>>
>
> You might want to look at this:
> http://search.cpan.org/dist/Schedule-Cron
>
Hi Alexey and all the others
I did take a look at perl, but i am a real perl noob.
This is what i have so far:
#!/usr/bin/perl
use Config::Crontab
$event = new Config::Crontab::Event( -data => '*/5 3 * * 5,6 /bin/blech' );
print $event->minute . "\n";
print $event->hour . "\n";
print $event->dom . "\n";
print $event->datetime . "\n";
print $event->command . "\n";
print $event->dump . "\n";
And if i run that i get:
*/5
3
*
*/5 3 * * 5,6
/bin/blech
*/5 3 * * 5,6 /bin/blech
Perhaps i am missing the obvious here.
Is there someone out there who can make a script that can read a
crontab line and give the time and date of the next time it will be
executed ?
output in the form:
secs_since_epoch,yyyy-mm-dd,hh:mm,command would be *great*
Many thanks in advance,
Ed
More information about the community
mailing list