The “every” command is that I wrote, inspired by the unix “at” command. It adds command to your crontab for you, using an easier to remember syntax. You can find it on github, here: https://github.com/iarna/App-Every
I was reminded because of this article on cron for perl programmers who are unix novices:
http://perltricks.com/article/43/2013/10/11/How-to-schedule-Perl-scripts-using-cron
Here’s how you’d write their examples using “every”:
$ every minute perl /path/to/Beacon.pl SHELL=/bin/bash PATH=/home/rebecca/bin:/opt/perl5/bin:/opt/perl5/perls/perl-5.16.2/bin:/opt/node/bin:/usr/local/bin:/usr/bin:/bin */1 * * * * cd "/home/rebecca"; perl /path/to/Beacon.pl $ every 5 minutes perl /path/to/Beacon.pl SHELL=/bin/bash PATH=/home/rebecca/bin:/opt/perl5/bin:/opt/perl5/perls/perl-5.16.2/bin:/opt/node/bin:/usr/local/bin:/usr/bin:/bin */5 * * * * cd "/home/rebecca"; perl /path/to/Beacon.pl $ every hour perl /path/to/Beacon.pl SHELL=/bin/bash PATH=/home/rebecca/bin:/opt/perl5/bin:/opt/perl5/perls/perl-5.16.2/bin:/opt/node/bin:/usr/local/bin:/usr/bin:/bin 49 */1 * * * cd "/home/rebecca"; perl /path/to/Beacon.pl $ every 12 hours perl /path/to/Beacon.pl SHELL=/bin/bash PATH=/home/rebecca/bin:/opt/perl5/bin:/opt/perl5/perls/perl-5.16.2/bin:/opt/node/bin:/usr/local/bin:/usr/bin:/bin 49 */12 * * * cd "/home/rebecca"; perl /path/to/Beacon.pl
What’s more, there’s no need to specify the path to Perl, because unlike using crontab straight up, it will maintain your path. Even better, you can use relative paths to refer to your script, eg:
$ every monday perl Beacon.pl
This works because every ensures that it executes from the place you set it up. Just like “at” it uses all of the same context as your normal shell.
Next post: Survey of node.js Gearman modules
Previous post: Easy ad-hoc publishing on a machine with Apache