Skip to content

Instantly share code, notes, and snippets.

@jangaraj
Last active January 29, 2019 10:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jangaraj/c4c9262fe04156a40b02 to your computer and use it in GitHub Desktop.
Save jangaraj/c4c9262fe04156a40b02 to your computer and use it in GitHub Desktop.
Basic cron wrapper
#!/bin/bash
# Reporting nonzero RC executions to syslog
# * * * * * root /usr/local/bin/errcron.sh <command>
# Installation: wget -O /usr/local/bin/errcron.sh https://gist.githubusercontent.com/jangaraj/c4c9262fe04156a40b02/raw/580ab988f9ff28c01cc9ee729ac9f0fe175b3a80/errcron.sh
OUT=$("$@" 2>&1)
RESULT=$?
if [ $RESULT -ne 0 ]
then
logger "CRONERROR: $@ $OUT"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment