Table of Contents

Several Tricks with Cron Jobs

Logging with systemd-cat

/usr/bin/systemd-cat -t topic-name.cron "/path/to/command arg1 arg2 argN"

Locking with flock

flock -xn /path/to/lock -c "/path/to/command arg1 arg2 argN"

Ping Monitoring with healthchecks.io

... && curl -fsS --retry 3 https://hchk.io/deadbeef-dead-beef-dead-beefdeadbeef > /dev/null

All-in-one

flock -xn /srv/mastodon-bots/mastodon-rss-bot-linux-amd64.lock -c "AIRTABLE_API_KEY=keyDEADBEEFISGOOD AIRTABLE_BASE_ID=appDEADBEEFISGOOD /usr/bin/systemd-cat -t mastodon-rss-bot.cron /srv/mastodon-bots/mastodon-rss-bot-linux-amd64 && curl -fsS --retry 3 https://hchk.io/deadbeef-dead-beef-dead-beefdeadbeef > /dev/null"