pingkeeper

Build Status Latest version Stability stable

Command line application that monitorises that network is reachable (direct tcp connection or ping) and, in case of failure, runs a command. Optionally it can monitor that the command is permanently running and restart it if network is unreachable.

Proudly made from Barcelona with Rust 🦀.

How does it work?

Flow Chart

Installation

Three options:

Cargo & Go

  1. If you already have cargo installed, use:

    cargo install pingkeeper
    

Manual download

  1. Download release binaries from releases page.

  2. recommended Check the integrity of the downloaded file:

    sha512sum --check pingkeeper-macos-v3.0.0.tar.gz.sha512
    

    It should say: pingkeeper-macos-v3.0.0.tar.gz: OK

  3. Extract archive with:

    tar xvf pingkeeper-macos-v3.0.0.tar.gz
    
  4. recommended Check the integrity of the binary file with:

    sha512sum --check pingkeeper.sha512
    

    It should say: pingkeeper: OK

  5. Copy pingkeeper binary file to somewhere within your $PATH, ie: /usr/local/bin.

Build it yourself

This requires the stable version of rust & cargo installed. Visit Rust website for more information.

  1. Run this command:

    cargo build --release
    
  2. You will find your executable at ./target/release/pingkeeper.

Usage

Usage examples

Usage manual

    USAGE:
    pingkeeper [FLAGS] [OPTIONS] <COMMAND>

    FLAGS:
    -h, --help
            Prints help information

    -k, --keep-alive
            Run command on start and restart it if command dies

    -q, --quiet
            Do not output anything from command output, also reduces -v by 1

            --use-ping
            Use ping command

    -V, --version
            Prints version information

    -v
            Verbose, -v -vv -vvv


    OPTIONS:
            --hosts <hosts>
            Hosts to ping, order is ignored [default: 8.8.8.8 8.8.6.6 1.1.1.1 1.0.0.1]

    -m, --max-errors <max-errors>
            Maximum number of command errors in a row, 0 for infinite [default: 0]

            --network-every <n>
            Check network again after this amount of seconds from the latest success [default: 5]

            --ping-opt <opts>
            Options for ping command, only valid with --use-ping [default: -c1]

            --port <port>
            Port to connect on every host, only valid without --use-ping [default: 53]

            --wait-after-exec <seconds>
            Seconds to check ping after executing command [default: 5]

    -s, --signal <signal>
            Signal to end command on command restart: `SIGINT`, `SIGTERM`, etc [default: SIGINT]

    -t, --timeout <timeout>
            Timeout in seconds, only valid without --use-ping [default: 2]


    ARGS:
    <COMMAND>
            Command to run

Changelog

v3.0.0

v2.0.0

v1.0.0

Backlog

License

Pingkeeper Copyright (C) 2020 Ignacio Lago

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.