Giter VIP home page Giter VIP logo

isitfinishedbot's Introduction

IsItFinishedBot

A utility for posting messages to slack when a shell command finishes

Examples

  • Send a message to a user

    ./iifb.py -u adrs -m "hello"

  • Send a file to a user

    ./iifb.py -u adrs setup.txt

  • Tell user when a long running command finishes

    ./iifb.py -u adrs -s "curl http://example.com/large_file -o file"

  • Run command and upload output to slack

    ./iifb.py -u adrs -s "ls -l > tmp.txt" tmp.txt What results look like in slack

  • Use boolean logic

./iifb.py -u adrs -s "(../run.sh 2>&1 > debug-output.txt && ls -lh > tmp.txt) || tail -n 30 debug-output.txt > tmp.txt" tmp.txt

If ../run.sh 2>&1 > debug-output.txt succeeds, runs ls -lh > tmp.txt and uploads results. If ../run.sh 2>&1 > debug-output.txt fails, uploads last 30 lines of debug-output.txt

Usage

Usage: iifb.py [options] [files]

A utility for running scripts and posting the results to slack.

If a shell command is specified, the shell command is run. The runtime and
return code are posted to slack along with any files and messages.

If a message is specified, the message is sent to specified user or channel.

The files specified do not need to exist. (ex: They could be logs generated
by the shell command)

By default, an authentication token is read from "~/.iifb.json". To
override this behavior, user the -t <token> option.


Options:
  -h, --help            show this help message and exit
  -u USER, --user=USER  User to send direct message to
  -c CHANNEL, --channel=CHANNEL
                        Channel to post message to
  -m MESSAGE, --message=MESSAGE
                        Message to post
  -s SHELL_COMMAND, --shell-command=SHELL_COMMAND
                        Shell command to run
  -t TOKEN, --token=TOKEN
                        Authentication token

Warnings

Slack limits file uploads to 1mb. Files are automatically truncated to stay within these limits. Slack file limits

Credits

Duck logo is from Wikipedia and is licensed under the Creative Commons.

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.