Executes the parameters, checks the exit code, prints log file to stderr in case exit code is not 0.
Helpful for running cron jobs to only get mails on errors, but with full logs attached
git clone https://gist.github.com/053acab10ecea3c4d0f9ec858a6b35b2.git ctr
./ctr/crrontab-runner.sh ./ctr/test-failing.sh
will print all possible information to stderr (and exit with the same error code as test-failing.sh
)
./ctr/crrontab-runner.sh ./ctr/test-success.sh
will only print the executed command and the logfile it writes to to stdout