I != SysADMIN
I am very proudly not a sys admin I am so bad in fact I can't even spell it correctly. This of course has its disadvantages in the perl world where it seems every perl knows what this does.
ls | perl -pe 's!([^_]+)_(.)(.*)!mv $1_$2$3 \u$2\E$3!gio'
and at a YAPC I was the only one in the room that did not laugh at this
su root chmod 000 chmod
I felt very left out.
Well call it my nature, as my natural skill set precludes sys-admin. I just find trying to remember all those commands I use once a year or even once in a job impossible for me. I have every respect for sys-admins I sort of see them like the surgeons of the tech-world, I know what they do and what they can do and I know I cannot do it half as well.
One task that I always spend too much time on is reading, correcting and entering cron entries. It seems simple enough but they always kill me. Where even the lowest grade sys-admin or junior programmer will see 'tue wed at 4 and 6 pm' I just a burble of meaningless '*', '-' and digits.
Well I think my long standing prayers have been answered by Bradley Andersen with his new mod 'ParseCron'.
Now I no longer have to run to wikipedia to look at the cron entry yet again to try and figure out what this means
22 4 * * 0 rdfsfdss rfdfdsfdsrts /etc/obstinate.pl
42 4 1 * * sfdsdfs rdfsfdss /etc/puge.pl
* 1,2,3,4 * * * sfdsdfs rdfsfdss /etc/email_all.pl
Now I will just drop in the offending crons into in my 8 line perl program below
use strict;
use ParseCron qw/parse_cron/;
my $cron =ParseCron->new();
my @crons = ('22 4 * * 0','42 4 1 * *','* 1,2,3,4 * * *');
foreach my $value (@crons){
my $readabe_by_john = $cron->parse_cron($value);
print $readabe_by_john."\n";
}
and I am of to the races
4:22am every Sunday
4:42am on the first of every month
Every minute of 1am, 2am, 3am, and 4am of every day
Opps I think I better go check that ' /etc/email_all.pl' program might explain the complaints from our users??
Anyway I can see this little gem coming in very handy.
Thanks again 'Bradley' if you ever see my at a YAPC I owe you 500g of Moose Jerky. Hopefully the one I bag this spring is a big one.
Wrote a short script for you:
https://github.com/sharyanto/scripts/blob/master/humanize-crontab
Example usage on the command-line:
App::every comes in handy too.