Git Product home page Git Product logo

horenso's Introduction

horenso(報・連・相)

Build Status Coverage Status MIT License

Description

Command wrapper for reporting the result. It is useful for cron jobs.

Installation

% go get github.com/Songmu/horenso/cmd/horenso

Built binaries are available on gihub releases. https://github.com/Songmu/horenso/releases

Synopsis

% horenso --reporter /path/to/report.pl -- /path/to/yourjob

Options

Usage:
  horenso --reporter /path/to/reporter.pl -- /path/to/job [...]

Application Options:
  -r, --reporter=/path/to/reporter.pl     handler for reporting the result of the job
  -n, --noticer='ruby/path/to/noticer.rb' handler for noticing the start of the job
  -T, --timestamp                         add timestamp to merged output
  -t, --tag=job-name                      tag of the job
  -o, --override-status                   override command exit status, always exit 0

Handlers are should be an executable or command line string. You can specify multiple reporters and noticers. In this case, they are executed concurrently.

Usage

Normally you can use horenso with a wrapper shell script like following.

#!/bin/bash
/path/to/horenso \
  -n /path/to/noticer.py         \
  -r /path/to/reporter.pl        \
  -r 'ruby /path/to/reporter.rb' \
  -- "$@"

And specify this wrapper.sh in the crontab like following.

3 4 * * * /path/to/wrapper.sh /path/to/job --args...

If you want to change reporting way, you just have to change reporter script. You have no risk to crash wrapper shell.

Execution Sequence

  1. Start the command
  2. [optional] Run the noticers
  3. Wait to finish the command
  4. Run the reporters

result JSON

The reporters and noticers are accept a result JSON via STDIN that reports command result like following.

{
  "command": "perl -E 'say 1;warn \"$$\\n\";'",
  "commandArgs": [
    "perl",
    "-E",
    "say 1;warn \"$$\\n\";"
  ],
  "output": "1\n95030\n",
  "stdout": "1\n",
  "stderr": "95030\n",
  "exitCode": 0,
  "result": "command exited with code: 0",
  "pid": 95030,
  "startAt": "2015-12-28T00:37:10.494282399+09:00",
  "endAt": "2015-12-28T00:37:10.546466379+09:00",
  "hostname": "webserver.example.com",
  "systemTime": 0.034632,
  "userTime": 0.026523
}

License

MIT

Author

Songmu

horenso's People

Contributors

songmu avatar fujiwara avatar nikushi avatar achiku avatar ariarijp avatar

Watchers

Thierry DEN HARTOG 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.