Giter VIP home page Giter VIP logo

gojobs's Introduction

GoJobs

GoJobs is a management tool for running concurrent bash commands in the same terminal. It logs the output of each command and tracks the final state.

It's intended as a simple way of monitoring the output of multiple services while testing, without having to run multiple terminals, background processes, or manually track PIDs.

Usage

Usage of gojobs:
  -add
    	adds a command to the jobs file
  -command string
    	command to run
  -dir string
    	directory to run the command in  
  -env string
    	environment variables to set, formatted as a json list in the form of ["key=value"]. 
    	(default to shells environment variables)
  -file string
    	file to use for jobs (default "jobs.json")
  -filter string
    	filter log output using this regex
  -logfile string
    	path to where logs are to be written or read from
  -logs
    	output logs
  -run
    	runs the commands in the jobs file
  -shell string
    	the shell to run the command in (default "/bin/bash")
  -tag string
    	tag to be applied to job output

Adding a job

You can add a command with only gojobs -add -command="[SHELL COMMAND]" -tag="[JOB TAG]". All other arguments are optional.

Warning: gojobs will by default copy the current environment variables as part of the job spec into the config. To override this behavior, use the -env flag to specify values as a json list in the form of ["key=value"].

For example, to pass only home, and user, the flag would look like

-env='["HOME=/home/user_name","USER=user_name"]'

example
gojobs \
    -add \
    -command="[SHELL COMMAND]" \
    -dir="[DIRECTORY TO RUN COMMAND]" \
    -shell="[PATH TO SHELL]" \
    -tag="[JOB TAG]" \
    -env="[JSON OF ENVIRONMENT VARIABLES]" \
    -file="[CONFIG FILE]"

Running jobs

After adding a job to your config, you can immediately run it with gojobs -run. If no log file is specified, then the output of the jobs will be written to the terminal only.

example
gojobs \
    -run \
    -file="[CONFIG FILE]" \
    -logfile="[LOG FILE]"

Alternatively, you can add a job, and immediately run it by specifying a new job in the arguments. This will add the job to the config, and execute the config in one command.

example
gojobs \
    -run \
    -command="[SHELL COMMAND]" \
    -dir="[DIRECTORY TO RUN COMMAND]" \
    -shell="[PATH TO SHELL]" \
    -tag="[JOB TAG]" \
    -env="[JSON OF ENVIRONMENT VARIABLES]" \
    -file="[CONFIG FILE]" \
    -logfile="[LOG FILE]"

View the log

You can replay the log to the terminal with gojobs -logs -logfile="[LOG FILE]". This will dump all command output to the terminal. You can filter logs by specifying a single tag to output, by using a regex pattern to filter the log message field, or both.

example
gojobs \
    -logs \
    -tag="[FILTER ON THIS TAG]" \
    -filter="[LOG FILTER REGEX]" \
    -logfile="[LOG FILE]"

Install

To install, make sure you have go installed, and your GOBIN is in your path. Then run

go get github.com/jmizell/GoJobs
go install github.com/jmizell/GoJobs/cmd/gojobs

gojobs's People

Contributors

jmizell avatar

Stargazers

 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.