Skip Menu |

This queue is for tickets about the Schedule-Cron CPAN distribution.

Report information
The Basics
Id: 51253
Status: resolved
Priority: 0/
Queue: Schedule-Cron

People
Owner: Nobody in particular
Requestors: dvk_mail [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Additional functionality suggestions
Date: Mon, 9 Nov 2009 14:41:29 -0800 (PST)
To: bug-Schedule-Cron [...] rt.cpan.org
From: DVK <dvk_mail [...] yahoo.com>
Roland, this is more of a wishlist than a bug report. It is based on the following StackOverflow question, which I attempted to answer based on your module. http://stackoverflow.com/questions/1704084/crontab-report-of-what-runs-in-a-specified-start-and-end-datetime/1704388#1704388 The wishlist is mostly to allow emulation of crontab (as opposed to actually running it) to see what WOULD HAVE BEEN ran. Improvements - most of which seem very simple - are: 1) FAST-FORWARD mode (specified in constructor) -- Ability to supply start/end time for fast-forward in constructor -- "$now=time;" replaced with $now++ in FF mode. the very first assignment should be from start_time mentioned in last bullet point -- sleep($sleep) replaced with NO-OP in FF mode -- every loop, check if $now reached end_time and if so, quit. 2) "read real crontab" mode. -- Ability to read "real" crontab file (or crontab -l output) -- Ability to automatically make the entries subroutines by either printing the commands listed in real crontab for FF mode, or by actually running them via system() call. Thanks!
Hi, I replied to the StackOverflow question, for reference, I put it here as well: There is a fine and clean solution for a 'simulation mode' of Schedule::Cron (and for any other module using sleep,time,alarm,...) internally without modifying Schedule::Cron itself. You can use Time::Mock for throtteling, e.g. with perl -MTime::Mock=throttle,600 schedule.pl one can speedup the 'time machine' by a factor 600 (so, instead of sleeping for 10 minutes it will only sleep a second). Please refer to the manpage of Time::Mock for more details. For using a crontab file directly with Schedule::Cron you should be able to take the example from the README directly: use Schedule::Cron; my $cron = new Schedule::Cron(sub { system(shift) }, file => "/var/spool/crontab.perl"); $cron->run(); The trick here is to use a default dispatcher method which calls system() with the stored parameters. Please let me know, whether this will work for you or whether it will need to be fixed. Instead of system, you could use print as well, of course. ============ So, IMO you can do all the requested features already in a clean way. Maybe I will include an example script for a simulation mode in the next version (whenever this will be ;-)
Subject: Re: [rt.cpan.org #51253] Additional functionality suggestions
Date: Tue, 10 Nov 2009 03:14:02 -0800 (PST)
To: bug-Schedule-Cron [...] rt.cpan.org
From: DVK <dvk_mail [...] yahoo.com>
WOW! Perfect! --- On Tue, 11/10/09, Roland Huss via RT <bug-Schedule-Cron@rt.cpan.org> wrote: Show quoted text
> From: Roland Huss via RT <bug-Schedule-Cron@rt.cpan.org> > Subject: [rt.cpan.org #51253] Additional functionality suggestions > To: dvk_mail@yahoo.com > Date: Tuesday, November 10, 2009, 5:02 AM > <URL: https://rt.cpan.org/Ticket/Display.html?id=51253 > > > Hi, > > I replied to the StackOverflow question, for reference, I > put it here as > well: > > There is a fine and clean solution for a 'simulation mode' > of > Schedule::Cron (and for any other module using > sleep,time,alarm,...) > internally without modifying Schedule::Cron itself. You can > use > Time::Mock for throtteling, e.g. with > > perl -MTime::Mock=throttle,600 schedule.pl > > one can speedup the 'time machine' by a factor 600 (so, > instead of > sleeping for 10 minutes it will only sleep a second). > Please refer to > the manpage of Time::Mock for more details. > > For using a crontab file directly with Schedule::Cron you > should be able > to take the example from the README directly: > > use Schedule::Cron; > my $cron = new Schedule::Cron(sub { system(shift) }, >                 >             >    file => "/var/spool/crontab.perl"); > $cron->run(); > > The trick here is to use a default dispatcher method which > calls > system() with the stored parameters. Please let me know, > whether this > will work for you or whether it will need to be fixed. > Instead of > system, you could use print as well, of course. > > ============ > > So, IMO you can do all the requested features already in a > clean way. > Maybe I will include an example script for a simulation > mode in the next > version (whenever this will be ;-) > >
 Fixed by providing an alternative solution ;-)