Config::Crontab

Config::Crontab is a Perl module used to read/write Vixie compatible crontab files.
Download

Config::Crontab Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Scott Wiersdorf
  • Publisher web site:
  • http://search.cpan.org/~scottw/

Config::Crontab Tags


Config::Crontab Description

Config::Crontab is a Perl module used to read/write Vixie compatible crontab files. Config::Crontab is a Perl module used to read/write Vixie compatible crontab files.SYNOPSIS use Config::Crontab; #################################### ## making a new crontab from scratch #################################### my $ct = new Config::Crontab; ## make a new Block object my $block = new Config::Crontab::Block( -data => last($block); ## make another block using Block methods $block = new Config::Crontab::Block; $block->last( new Config::Crontab::Comment( -data => '## do backups' ) ); $block->last( new Config::Crontab::Env( -name => 'MAILTO', -value => 'bob' ) ); $block->last( new Config::Crontab::Event( -minute => 40, -hour => 3, -command => '/sbin/backup --partition=all' ) ); ## add this block to crontab file $ct->last($block); ## write out crontab file $ct->write; ############################### ## changing an existing crontab ############################### my $ct = new Config::Crontab; $ct->read; ## comment out the command that runs our backup $_->active(0) for $ct->select(-command_re => '/sbin/backup'); ## save our crontab again $ct->write; ############################### ## read joe's crontab (must have root permissions) ############################### ## same as "crontab -u joe -l" my $ct = new Config::Crontab( -owner => 'joe' ); $ct->read;A Config::Crontab object allows you to manipulate an ordered set of Event, Env, or Comment objects (also included with this package). Descriptions of these packages may be found below.In short, Config::Crontab reads and writes crontab(5) files (and does a little pretty-printing too) using objects. The general idea is that you create a Config::Crontab object and associate it with a file (if unassociated, it will work over a pipe to crontab -l). From there, you can add lines to your crontab object, change existing line attributes, and write everything back to file.NOTE: Config::Crontab does not (currently) do validity checks on your data (i.e., dates out of range, etc.). However, if the call to crontab fails when you invoke write, write will return undef and set error with the error message returned from the crontab command. Future development may tend toward more validity checks.Now, to successfully navigate the module's ins and outs, we'll need a little terminology lesson. Requirements: · Perl


Config::Crontab Related Software