Skip to main content
https://farm9.staticflickr.com/8144/7544169948_8abb2bb2f3_m_d.jpg

Cronfed monitors basic batch jobs, or any other cron-based scheduled commands by parsing a given mailbox and turning it into an RSS feed. The feed can in turn be monitored with your browser, feedreader or other RSS-compatible service (such as IFTTT).

Simply add a cron job to generate the feed, pointing it at a web-accessible location (such as a public_html directory or your site’s assets directory). Check out the example for some real-world Cronfed usage, with an explanation of how cron and Cronfed work together.

Cronfed is Minimum Viable Monitoring, aimed at providing a basic threshold of monitoring without complex automation or dependencies. It’s targeted at smaller projects which otherwise might go without any monitoring at all. It’s so easy to set up and use on the standard Linux/BSD machine that there’s no reason to not use it from Day 1. While Cronfed makes attempts at limiting the amount of information externalized, it is not recommended for jobs with extremely-sensitive information.

“Cronfed: It’s the least you could do!”

Installation

Cronfed is pure Python, has no system library dependencies, and should work wonders on any POSIX machine with a functioning cron daemon and local mail system:

pip install cronfed

Run python -m cronfed --help to see options, or read on for a usage example.

Example

First, let’s look at a basic cron job. This one will fetch our data once an hour, on the hour:

0 * * * * /usr/bin/python /home/myuser/project/fetch.py 2>&1 | tee -a /home/myuser/project/logs/fetch.txt

Notice how the output (stdout + stderr) is piped to a log file, but using the tee command. This ensures that the output goes to the file as well as stdout. cron captures that stdout and puts it into an email, which then gets sent to the user who owns the job. This usually means the email goes to myuser@localhost, which on many distributions means that it is saved to /var/mail/myuser. Do note that if the command generates no output, then cron will not send an email, so it’s a good idea to emit an error message.

Once we’re sure that email is being delivered, we’re halfway there. Now we just need the actual Cronfed cronjob:

*/15 * * * * /usr/bin/python -m cronfed --output /var/www/mysite/assets/cronfed.rss /var/mail/myuser 2>&1 | tee -a /home/myuser/project/logs/cronfed.txt

In this example we have the installed cronfed module regenerating our feed every fifteen minutes. This is a pretty quick process in most cases, so feel free to make it more often. In this case, the output of cronfed itself is monitored in exactly the same way as normal cron jobs, with a logfile and email to user@localhost.

History

Cronfed was created for Hatnote to monitor the periodic data refreshes necessary to generate The Weeklypedia. See those cron jobs and more in the Weeklypedia crontab.

Release files for cronfed 20.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cronfed 20.0.0
File Size Uploaded
cronfed-20.0.0.tar.gz 6.2 kB Details

Release files / cronfed-20.0.0.tar.gz

Download URL cronfed-20.0.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
917dc62591365088ae6e73058b56112419b64749678e19f33a03e41e4be02a3a
BLAKE2b-256 checksum
How to use checksums
98cf26ae2f343e2ba4b19808c724502c20f2969465efc06d2e3efa4c1d1f743f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/2.7

Release history Release notifications | RSS feed

This release

20.0.0 This release

1 release file

0.2.1

1 release file

0.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page