Don't ask to ask, just ask | |
PerlMonks |
Re: Manipulating crontabby ZZamboni (Curate) |
on Jun 21, 2001 at 20:18 UTC ( [id://90438]=note: print w/replies, xml ) | Need Help?? |
Some time ago I wrote the code below to sort my crontab file by
time (see sub compare_crons for the sorting criteria). It's
very crude, but it could work as a starting point for reading
a crontab file in memory. Once you read it in, you can make
any changes, write it to a new file, an run the crontab command
on it. This program leaves in each element of @db an array reference containing the 5 time fields, and a text element containing the current line, together with any comments that came before it. Of course, for making any modifications, this second element would have to be split further.
--ZZamboni
In Section
Seekers of Perl Wisdom
|
|