Created
December 18, 2017 21:16
-
-
Save fawkesley/b0d27fe85cf8e83b175c4adac7178909 to your computer and use it in GitHub Desktop.
cron-wrap
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
#!/bin/sh -u | |
LOG_FILE="${HOME}/log/$(date --iso-8601=seconds).log" | |
touch "${LOG_FILE}" | |
$1 "$@" >> ${LOG_FILE} 2>&1 | |
EXIT_CODE=$? | |
if [ "${EXIT_CODE}" -ne "0" ]; then | |
tail -n 100 "${LOG_FILE}" | |
exit ${EXIT_CODE} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment