This is where I am at...I've been able to write a file with the correct syntax, but how do I actually import that file into crontab itself. i.e. crontab -u <user> <file>
Here is what I have done so far...
my $ct = new Config::Crontab;
my @event;
if ($special eq 'hourly'){
@event = ( new Config::Crontab::Comment(-data => '## foo' ),
new Config::Crontab::Event( -datetime => '4 * * * Sun',
-command => "/usr/bin/perl
+ $bsql::cron_command"));
}
elsif ($special eq 'daily'){
@event = ( new Config::Crontab::Comment(-data => '## foo' ),
new Config::Crontab::Event( -minute => 00,
-hour => 4,
-command => "/usr/bin/perl
+$bsql::cron_command"));
}
elsif ($special eq 'weekly'){
@event = ( new Config::Crontab::Comment(-data => '## foo' ),
new Config::Crontab::Event( -dow => 'Sun',
-minute => 00,
-hour => 4,
-command => "/usr/bin/perl
+$bsql::cron_command"));
}
elsif ($special eq 'monthly'){
@event = ( new Config::Crontab::Comment(-data => '## foo' ),
new Config::Crontab::Event( -datetime => '0 0 4 1 * *',
-command => "/usr/bin/perl
+ $bsql::cron_command"));
}
my $block = new Config::Crontab::Block;
## add this block to crontab file
$block->lines(\@event);
$ct->last($block);
## write out crontab file
$ct->write("$bsql::dir/backup/crontab");