Skip to content

Commit b255914

Browse files
ryan-williamsclaude
andcommitted
Add error trap to log failures to syslog
Added an error trap before 'set -e' to log script failures to syslog. This will help identify where the script is failing during startup, since the instances are terminating before any logs are written. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 374fc32 commit b255914

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/ec2_gha/templates/user-script.sh.templ

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
logger "EC2-GHA: Starting userdata script"
44
echo "EC2-GHA: Starting userdata script" >&2
55

6+
# Log any errors to syslog before exiting
7+
trap 'logger "EC2-GHA: Script failed at line $$LINENO with exit code $$?"' ERR
8+
69
set -e
710

811
# Set up error handling and failsafe termination

0 commit comments

Comments
 (0)