crarchive 0.1

Download crarchive version 0.1.

Here's a little program I wrote to solve a small problem I've been having with cron. Say one has in one's crontab the following line:

0 0 * * * /usr/bin/rsync -avz dir1/ /backup/dir1/

This backs up dir1 to a backup directory. rsync, however, creates a lot of output (especially with the -v switch)... and cron sends that output to your email, so every day, you'll be getting an email message from cron with the results of the backup. To avoid this, most people simply redirect the output to /dev/null. What if I do actually want to see the output though, just not in my inbox?

crarchive is a little script that will log the results of cron runs in a folder, gzip old logs, and delete really old logs automatically. It allows the output of commands run in cron to be saved and archived, but without clogging up your inbox. Eventually, it will also support more customizability, but because this is only the first release, it has the following limitations...

  • Maximum one run per day
  • Logs to $HOME/logs (unchangeable)
  • Gzips logs that are one day old, deletes logs that are thirty (unchangeable)

crarchive will, however, email you if something goes wrong (unfortunately, again, error checking in this early version is primitive). Here's a usage example with the crontab from earlier (assuming we've installed crarchive.py into /usr/bin):

0 0 * * * /usr/bin/rsync -avz dir1/ /backup/dir1/ | /usr/bin/crarchive.py rsync-dir1

Where rsync-dir1 is an arbitrary name that you choose.

I'm currently using crarchive to log an awstats update that I'm running in my crontab. If you think that crarchive would be of some use to you, download version 0.1.

Comments

comments powered by Disqus