Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

DateTime::Event::Cron

by steves (Curate)
on Dec 18, 2004 at 14:32 UTC ( #415860=perlquestion: print w/ replies, xml ) Need Help??
steves has asked for the wisdom of the Perl Monks concerning the following question:

Has anyone used DateTime::Event::Cron?

It looks useful but I got hung up immediately on some basics. This code should, I think, show me each crontab entry, then show me just the command:
use strict; use DateTime::Event::Cron; my @entries = DateTime::Event::Cron->new_from_crontab (file => '/tmp/crontab.out'); my $entry; foreach $entry (@entries) { print $entry->original(), "\n"; print " ", $entry->command(), "\n"; }
The full entry prints fine, but the commands are all missing the leading token of the command (the program name) -- only the command arguments are shown. I believe all of the commands are full paths and therefore contain forward slashes. Some of the docs. point to an expanded cron syntax that supports slashes, so I'm wondering if maybe that has something to do with it.

At any rate, I'd be interested to hear other monks' experience with this module.

Comment on DateTime::Event::Cron
Download Code
Re: DateTime::Event::Cron
by Anonymous Monk on Dec 19, 2004 at 05:03 UTC
    try twiddling the user_mode.
    my @entries = DateTime::Event::Cron->new_from_crontab (file => '/tmp/crontab.out', user_mode => 0);
    systemwide crontabs have a user field (gump):
    * * * * * gump /bin/date
    user crontabs don't:
    * * * * * /bin/date
Re: DateTime::Event::Cron
by steves (Curate) on Dec 19, 2004 at 11:01 UTC

    That was it. Thanks!

Re: DateTime::Event::Cron
by mojotoad (Monsignor) on Dec 21, 2004 at 04:28 UTC
    The above answer from Anonymous Monk, regarding tweaking the user_mode parameter, is the correct one as I also answered on the DateTime mailing list.

    It would be useful, however, if you could provide an example crontab entry that is failing, since the module makes an attempt to figure out the correct mode automatically. Something in your particular crontab file is throwing it off and I'd like to know what.

    Cheers,
    Matt

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://415860]
Approved by castaway
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-11-28 04:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (193 votes), past polls