Git Product home page Git Product logo

keep_running's Introduction

KeepRunning

You can run but you can’t hide.

KeepRunning restarts a Ruby script whenever it stops, crashes or is killed.

There’s two modes to use KeepRunning: Using the keep_running bin with a config file (see example_runner_conf) or using a KeepRunning script (see example_runner_script). The only difference is a shebang line and a require line in the KeepRunning script. (Actually the script could as well being used as configuration file; This isn’t true the other way round)

The invokation would look like this:

keep_running example_runner_conf one two three
./example_runner_script one two three

All further arguments will be passed to the process to be run. For the process running $0 will be it’s own path. So basically if your Ruby script works on it’s own, it’s scriptname $0 and command line arguments ARGV will be the same when launched by KeepRunning.

Synopsis

A runner config would look like this:

KeepRunning.run do
  pidfile             '/tmp/keep_running_example'
  email               to: '[email protected]', from: '[email protected]', via: :sendmail
  restart_threshold   6
  restart_delay       60
  
  process 'example_script.rb'
end

restart_threshold defines how many seconds must be between restarts until a delay of restart_delay seconds is kicking in.

Caveats

This is a quick and dirty hack. Specs will follow soon.

keep_running's People

Contributors

niko avatar

Stargazers

 avatar  avatar

Watchers

 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.