I've already stated my allegiance to FCron, but after using it for quite some while and writing an article or two about it already (see Publications subpage), I think it's time I shared my fcrontabs.

Since FCron is such a nice and vertisable command scheduler, I can depend that everything's going to get done even though my laptop is not up 24/7.

fcrontab -e systab lets me edit my system fcrontab (note: systab ≠ root's fcrontab):

# All FCron notifications are e-mailed to normal user
MAILTO=hook

# Updates 'slocate' and 'man' every day as well as rotates logs (all in a nice manner).
%daily,nice(7),random,mail(no) * 10-14 makewhatis -u
%daily,nice(7),random,mail(no) * 16-18 updatedb
%daily,nice(7),mail(no) * * logrotate /etc/logrotate.conf

# Once a month (as soon as possible) my Portage tree is updated and the results e-mailed to my normal user's account.
%monthly,nice(7)mail * 16-23  * eix-sync; emerge -DNuvp world

# Once a month on a random days I some general cleaning of the Portage tree occurs and e-mails me the output
%midmonthly,nice(7),random,mail * * * eclean-dist --destructive --nocolor; eclean-pkg --destructive --nocolor; eix-test-obsolete detailed
%midmonthly,nice(7),random,mail * * * ls /var/tmp/portage/*

# Once a month on random days I get e-mailed which live and unmasked packages I have installed
%midmonthly,nice(7),random,mail * * * cd /etc/portage/package.accept_keywords/; ack "\*" *
%midmonthly,nice(7),random,mail * * * qlist -ICv | grep 9999

# On a (random) weekly basis I get e-mailed GLSA check for an
%weekly,nice(7),random,mail * * glsa-check --nocolor -l affected

And here's my normal user's everyday stuff, accessible by fcrontab -e:

# Twice a week the weather report gets printed automatically and an e-mail notifies me when I can take it from the printer or whether there's been a problem
%weekly,mail * 06-23 sleep 500; wget http://www.yr.no/place/Slovenia/Ljubljana/Ljubljana/varsel.pdf -O /tmp/vreme.pdf && lpr /tmp/vreme.pdf && echo "Weather report printed." || echo "ERROR: Weather report *not* printed!" ; rm /tmp/vreme.pdf*

%midweekly,mail * 06-23 sleep 500; wget http://www.yr.no/place/Slovenia/Ljubljana/Ljubljana/varsel.pdf -O /tmp/vreme.pdf && lpr /tmp/vreme.pdf && echo "Vremenska napoved je stiskana." || echo "NAPAKA: Vremenska napoved *ni* stiskana!" ; rm /tmp/vreme.pdf*

# Using curl magic to automatically send updates to Status.net; I don't need e-mail notification of that ;)
%nightly,mail(no) * * curl https://identi.ca/api/statuses/update.xml -u johndearheart: -d status='GNU John Dearheart → !discworld'

%daily,mail(no) * * curl https://identi.ca/api/statuses/update.xml -u dwtrivia: -d status="`fortune discworld pqf -n 128 -s`"' → !discworld'

Note 1: I prefer to use the %*LY commands to define cronjobs, because they fit my needs the most. FCron itself uses all sorts of ways how to define the time when a cronjob should be executed – from strict date+time (like in "normal" Crons) to intervals and even defined by uptime.

Note 2: Of course, in the last two (f)cronjobs the passwords were censured ;)

I hope this whet your appetite and you'll be anxious to try it and find your own way of how to make your life easier with FCron :]

hook out → doing "schoolwork" for my potential new legal counselling job

Update: Included some more jobs like logrotate.


Related Posts


Published

Category

Tehne

Tags