Scron

scheduler for laptops which aren't on 24/7

Scron schedules commands to run daily, weekly, monthly, or annually. If your machine is off, scron will attempt to run a scheduled as soon as possible. See Scron on GitHub.

Install

$ gem install scron
$ crontab -e
0 */2 * * * scron -r

Install as a rubygem via gem install scron. Then configure cron to run it every 2 hours.

Configure

$ vim ~/.scron
1d        daily-cmd
7d        7-days-cmd
Mo,Fr     mondays-and-fridays-cmd
1st,23rd  twice-a-month-cmd
4/15      once-a-year-cmd

Scron can be configured via the ~/.scron file. It uses a simple format: left column for schedule and right column for unix command.

Scron will attempt to run whenever a schedule goes stale. For example, if its been 25 hours since the last run and the command is scheduled for 1d. Or if your laptop was off on Friday but on Saturday, and the command was scheduled for Fridays.

Debugging

$ cat ~/.scronlog
$ cat ~/.scrondb

Last run timestamps are stored in ~/.scrondb. STDOUT of commands with timestamps are logged in ~/.scronlog.


Scron is released under the BSD License and developed by Hugh Bien. Follow me via @hughbien.