Git Product home page Git Product logo

gobeat's Introduction

gobeat

gobeat is a health check monitor, command automation tool and a process restarter, for any process found by name or pid.

Installation

go get -u github.com/radovskyb/gobeat

Usage

gobeat -pid=1234 -cmd="go run myscript.go"
gobeat -name="subl" -cmd="./mybashscript"

Example

sudo gobeat -pid=1234 -cmd="go run sendemail.go"
  1. Run with sudo so gobeat will restart the server in the same terminal tty that it originated in. (sudo)
  2. Point gobeat to the process of the running server that you want gobeat to monitor. (gobeat -pid=1234)
  3. Set the cmd flag to run a Go file that will send an email notifying you that the server was restarted. (-cmd="go run sendemail.go")

Todo

  • Make health check poll interval customizable.
  • Write some tests.

Description

gobeat is started by passing it a minimum flag that it requires to work, either a pid (process id) which can be found using ps in the terminal, or a name which finds and lists all processes containing that name, where the correct process is then chosen from the list.

Once running, gobeat regularly health checks the running process.

If the process has been shut down and the restart flag is set to true, which is the default, gobeat automatically restarts the process.

When the process that needs to be restarted was instantiated in a terminal window, for example, /dev/ttys001, gobeat automatically restarts the process in the tty that it originated in (requires sudo).

For processes not started in a terminal, gobeat will simply restart the application.

The detach flag specifes whether or not an application that is restarted gets attached to gobeat's process. An attached process will be killed when gobeat is killed, whereas a deatched process will continue to run.

gobeat also accepts a cmd flag, which specifies a command to be run anytime the process being watched is killed or restarted.

gobeat uses lsof and ps for finding process information since /proc/ is not available on MacOS.

gobeat's People

Contributors

radovskyb avatar

Watchers

 avatar  avatar  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.