Skip to content

Instantly share code, notes, and snippets.

@oakwhiz
Last active November 9, 2023 06:47
Show Gist options
  • Save oakwhiz/6c6ea94ed32e692614d6 to your computer and use it in GitHub Desktop.
Save oakwhiz/6c6ea94ed32e692614d6 to your computer and use it in GitHub Desktop.
How to configure crond to send cron job output to the system journal

How to configure crond to send cron job output to the system journal

Keywords: fedora 20, systemd, cron, crond, output, stdout, journal

Problem: You want to capture and read the output of your cron jobs, but the output isn't being logged anywhere.

Solution: Add an argument to crond.

Step 1. Open /etc/sysconfig/crond for editing.

$ sudo nano /etc/sysconfig/crond

Step 2. Add the -s switch to CRONDARGS so that it looks like the following:

# Settings for the CRON daemon.
# CRONDARGS= :  any extra command-line startup arguments for crond
CRONDARGS=-s

Step 2. Restart the crond service.

$ sudo systemctl reload-or-restart crond.service

Step 3. Wait for crond to run your cron job at the next scheduled interval. Afterwards, examine the journal for the output.

$ journalctl --boot | grep CMDOUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment