Line 60... |
Line 60... |
60 |
# simple function to return true if the current date is the first of the week, month or year
|
60 |
# simple function to return true if the current date is the first of the week, month or year
|
61 |
# parameter passed in is 'w' (weekly), 'm' (monthly) or 'y' (yearly)
|
61 |
# parameter passed in is 'w' (weekly), 'm' (monthly) or 'y' (yearly)
|
62 |
# to have a test run only weekly, place
|
62 |
# to have a test run only weekly, place
|
63 |
# exit 1 unless &checkDate( 'w' );
|
63 |
# exit 1 unless &checkDate( 'w' );
|
64 |
sub checkDate {
|
64 |
sub checkDate {
|
- |
|
65 |
return 1 if -e '/tmp/sysinfo.firstrun';
|
65 |
my $frequency = lc shift;
|
66 |
my $frequency = lc shift;
|
66 |
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
67 |
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
67 |
return $mday == 1 if $frequency eq 'm'; # monthly
|
68 |
return $mday == 1 if $frequency eq 'm'; # monthly
|
68 |
return $wday == 1 if $frequency eq 'w'; # weekly
|
69 |
return $wday == 1 if $frequency eq 'w'; # weekly
|
69 |
return $yday == 1 if $frequency eq 'y'; # yearly
|
70 |
return $yday == 1 if $frequency eq 'y'; # yearly
|