Coder Social home page Coder Social logo

slack-cron's Introduction

Introduction

A simple tool writen in PHP using some symfony components.
Used to execute a command and send errors or output to slack using Incoming Webhooks (usefull for cron jobs).

Requirements

  • PHP 5.6 and up.
  • cURL accessible from path.
  • composer to install dependencies.

Installation

Via composer

$ composer create-project qtsd/slack-cron slack-cron dev-master --keep-vcs

From sources

$ git clone [email protected]:qtsd/slack-cron.git
$ composer install -d slack-cron

Configuration

Path
You can link the app to the path to use it from everywhere.
The symlink should conventionally be on /usr/local/bin, but cron path do not include it, so use /usr/bin instead.

$ sudo ln -s `pwd`/slack-cron/bin/console /usr/bin/slack-cron

Slack
Slack webhook url is asked on composer install, and will be kept in conf/parameters.yml.
To get a webhook url, go on Slack > Getting started with custom integrations > New webhook.

Documentation

Usage
run [options] <exec> [<path>]

Arguments

  • exec The command to execute.
  • path The working directory.

Options

  • --timeout[=TIMEOUT] Command timeout in seconds [default: 120]
  • --output-all Send all output to slack (not just errors)

Examples

Call from path

$ slack-cron run [...]

Call from install directory

$ bin/console run [...]

List files of the current directory, and send output to slack

$ slack-cron run 'ls -al' --output-all

Try to create a file /foo.txt, and send output to slack if encounter an error

$ slack-cron run 'touch foo' /

License

Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

slack-cron's People

Contributors

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