Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reporting bash script failures to Sentry

Tags:

bash

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?

like image 507
Mikko Ohtamaa Avatar asked Sep 16 '25 16:09

Mikko Ohtamaa


1 Answers

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/

like image 126
ssenseless Avatar answered Sep 19 '25 06:09

ssenseless