Code Monkey home page Code Monkey logo

spchk's Introduction

SPCHK (Server Port Checker)

This script is quite similar of SUP, however this one is so much more flexible. It's not just to keep a service running, it was made to check if a port in the server is listening. If its port is down, the Server Port Checker will execute a command setted by you, such as, your PHP script, service or even another script which may send an email to the server administrator.

Installation

$ sudo su -
$ cd /tmp/
$ wget https://github.com/luoldrigues/spchk/archive/master.zip
$ unzip master.zip; cd spchk-master
$ mv spchk /usr/local/bin
$ spchk --help

Help

$ spchk --help
Usage: $FILENAME [OPTIONS...]

OPTIONS:
  -p, --port       Port of the process
  -e, --execute    Command to execute if the process is not working
  -v, --verbose    Verbosely list processed
  -h, --help       Show this help
      --usage      Give you a short usage message
      --version    Print program version

Examples:
   $FILENAME -p 8000 -e "php -q /var/www/html/script.php" -v
   $FILENAME -p 80 -e \"systemctl start httpd.service\"
   $FILENAME --usage

You might use this program in your crontab
Cron example:
  */15 * * * * $0 -p 8000 -e "php -q /var/www/html/script.php"
  The line above execute every 15 minutes to check the script.php is working at port 8000
  For more details see 'man crontab'

Usage

$ spchk --usage
Usage: $FILENAME --port <number> --execute <command> [--verbose] [--usage] [--version]

Examples:
   $FILENAME --port 8000 --execute "php -q /var/www/html/script.php" --verbose
   $FILENAME --port 80 --execute "systemctl start httpd.service"
   $FILENAME --help

Version

$ spchk --version
spchk version 0.1
GNU License <http://gnu.org/licenses/gpl.html>.
This is a free software! You are allowed to change and redistribute it for free.
Written by Luan Rodrigues - https://github.com/luoldrigues

Compatible

  • Red Hat 7
  • Centos 7
  • Fedora 7

spchk's People

Contributors

luoldrigues avatar

Stargazers

Marcel Melo avatar

Watchers

James Cloos 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.