Git Product home page Git Product logo

ewn-go's Introduction

Execute With Notify

Go Report Card Build Status
This is wrapper script, what can notify you when your tasks failed.

Features

  1. Notify with email
  2. Publish logs to Graylog/Logstash
  3. Prevent duplicate processes
  4. Retry failed commands

Install

  1. Download binary from Release page or build it with go build main.go
  2. Run ewn --initconfig. This command create default config file (default config path: /etc/ewn.conf)
  3. Update config file with your parameters

Usage

  • Exec command with notify for default recipients ('[email protected]' and '[email protected]'):
    ewn -c 'echo "This is test command" && /bin/false'
  • Exec command with notify for custom recipients ('[email protected]' and '[email protected]'):
    ewn -c 'echo "This is test command" && /bin/false' -r "[email protected]" "[email protected]"
  • 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 "[email protected]" "[email protected]" --retry 3 --retry-sleep 30 --valid-exitcodes 1 --comment "This command will never fail because 1 in valid exitcodes"

License

GPL v3

ewn-go's People

Contributors

larrabee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.