Down­load crarchive ver­sion 0.1.

Here’s a lit­tle pro­gram I wrote to solve a small prob­lem I’ve been hav­ing with cron. Say one has in one’s crontab the fol­low­ing line:

0 0 * * * /usr/bin/rsync -avz dir1/ /back­up/dir1/

This backs up dir1 to a back­up di­rec­to­ry. rsync, how­ev­er, cre­ates a lot of out­put (espe­cial­ly with the -v switch)… and cron sends that out­put to your email, so ev­ery day, you’ll be get­ting an email mes­sage from cron with the re­sults of the back­up. To avoid this, most peo­ple sim­ply redi­rect the out­put to /dev/null. What if I do ac­tu­al­ly want to see the out­put though, just not in my in­box? crar­chive is a lit­tle script that will log the re­sults of cron runs in a fold­er, gzip old logs, and delete re­al­ly old logs au­to­mat­i­cal­ly. It al­lows the out­put of com­mands run in cron to be saved and archived, but with­out clog­ging up your in­box. Even­tu­al­ly, it will al­so sup­port more cus­tomiz­abil­i­ty, but be­cause this is on­ly the first re­lease, it has the fol­low­ing lim­i­ta­tions…

  • Max­i­mum one run per day
  • Logs to $HOME/logs (un­change­able)
  • Gzips logs that are one day old, deletes logs that are thir­ty (un­change­able)

crar­chive will, how­ev­er, email you if some­thing goes wrong (un­for­tu­nate­ly, again, er­ror check­ing in this ear­ly ver­sion is prim­i­tive). Here’s a usage ex­am­ple with the crontab from ear­lier (as­sum­ing we’ve in­stalled crar­chive.py in­to /usr/bin):

0 0 * * * /usr/bin/rsync -avz dir1/ /back­up/dir1/ | /usr/bin/crar­chive.py rsync-dir1

Where rsync-dir1 is an ar­bi­trary name that you choose.

I’m cur­rent­ly us­ing crar­chive to log an aw­stats up­date that I’m run­ning in my crontab. If you think that crar­chive would be of some use to you, down­load ver­sion 0.1.