This is wrapper script, what can notify you when your tasks failed.
- Notify with email
- Publish logs to Graylog/Logstash
- Prevent duplicate processes
- Retry failed commands
- Download binary from Release page or build it with
go build main.go
- Run
ewn --initconfig
. This command create default config file (default config path:/etc/ewn.conf
) - Update config file with your parameters
- Exec command with notify for default recipients ('user1@example.com' and 'user2@example.com'):
ewn -c 'echo "This is test command" && /bin/false'
- Exec command with notify for custom recipients ('user3@example.com' and 'user4@example.com'):
ewn -c 'echo "This is test command" && /bin/false' -r "user3@example.com" "user4@example.com"
- Exec command with comment message. It will be attached to email and Graylog message:
ewn -c 'echo "This is test command" && /bin/false' --comment "This command will always fail"
- Exec command that prevent duplicate processes:
ewn -c 'echo "This is test command" && /bin/sleep 3600' --dont-duplicate
- Exec command that prevent duplicate processes with custom key (by default it is --command). It useful when you have different commands:
ewn -c 'echo "This is first command" | tee /tmp/file && /bin/sleep 3600' --dont-duplicate --dont-duplicate-key "conflicting commands"
ewn -c 'echo "This is second command" | tee /tmp/file && /bin/sleep 3600' --dont-duplicate --dont-duplicate-key "conflicting command"
- Exec command with 3 retry on failure and 30 sec interval between retries:
ewn -c 'echo "This is test command" && /bin/false' --retry 3 --retry-sleep 30
- Exec command with custom valid exit codes (default is 0). If command exit with exit code 1, 3 or 255 email will not sent.
ewn -c 'echo "This is test command" && /bin/false' --valid-exitcodes 1 3 255
You can combine any keys like:
ewn -c 'echo "This is test command" && /bin/false' -d --dont-duplicate -r "user3@example.com" "user4@example.com" --retry 3 --retry-sleep 30 --valid-exitcodes 1 --comment "This command will never fail because 1 in valid exitcodes"
GPL v3