2 # Only runs the specified cron job if within the date range
3 # XXX support in usermin
8 ($start, $end, @cmd) = @ARGV;
9 $start && $end && scalar(@cmd) || die "usage: range.pl dd-mm-yyyy dd-mm-yyyy command ...";
10 $stime = &parse_date($start);
11 $stime || die "Invalid start date $start";
12 $etime = &parse_date($end);
13 $etime || die "Invalid ending date $end";
15 # Check time range (inclusive)
17 if ($now < $stime || $now >= $etime+24*60*60) {
22 exec("/bin/sh", "-c", join(" ", @cmd));
26 ($d, $m, $y) = split(/\-/, $_[0]);
27 $y =~ /^\d+$/ && $m =~ /^\d+$/ && $d =~ /^\d+$/ || return undef;
28 return eval { timelocal(0, 0, 0, $d, $m-1, $y-1900) };