Created
November 12, 2022 21:34
-
-
Save martinbutt/4cb8f0cb1e65abbf1a67ffd9677629e5 to your computer and use it in GitHub Desktop.
Crontab to allow output, but only email it if the script fails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* * * * * script.sh &> tmp_file || (echo Script failed with exit code $?; cat tmp_file); rm -f tmp_file > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment