Search code examples
bashsentry

Reporting bash script failures to Sentry


If I run a bash script with set -e it aborts with an error. I am running some maintenance shell script, along with Python application code, and I'd like to report errors from the shell scripts to Sentry as well.

What options do I have? What kind of traps bash provides and what kind of command line integration there exists for pushing errors to Sentry?


Solution

  • For bash scripts you can enable automatic error sending by using the sentry-cli bash hook. That enables set -e and will send a sentry event for unhandled errors. https://docs.sentry.io/product/cli/send-event/