zycrophat / ifpl

ifpl runs the given command and waits for the process with pid <pid> to terminate. Upon termination of the process with pid <pid> the spawned process will be killed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitHub Build Status Release Status

ifpl ─ if process lives

Description

ifpl runs the given command (say, as process p1) and waits for a process with a specified pid (process p2) to terminate. Upon termination of p2, ifpl will kill p1.

Usage

$ ifpl [-h] [-p PID] [-s SIGNAL] [-v] [-l LOGFILE] CMD [ARGS ...]

Where:

  • -h displays a help message
  • -p PID specifies the PID of the process to wait for to terminate. Defaults to ppid of ifpl.
  • -s SIGNAL specifies a signal to send to the CMD child process
  • -v prints ifpl log messages to stdout
  • -l LOGFILE file to write log messages to
  • CMD [ARGS ...] specifies the CMD and optionally arguments

ifpl runs the given CMD and waits for the process with pid PID to terminate. Upon termination, the CMD child process will be killed. When the -s option is specified with a non-negative value, the given signal will be sent to the CMD child process. Otherwise go's os.Process.Kill() will be used.

ifpl returns with the exit status of CMD or with 255 if an error occurred.

Compatibility

Currently, ifpl runs on Microsoft Windows. For Unix/Linux procfs is required.

How to build

Prerequisites:

  • Go1.14
  • Make (optional)

To compile:

$ cd cmd/ifpl
$ go build

To build distributable archives for Linux & Windows:

$ make dist-windows-x86-64 dist-linux-x86-64 dist-linux-arm64

About

ifpl runs the given command and waits for the process with pid <pid> to terminate. Upon termination of the process with pid <pid> the spawned process will be killed.

License:MIT License


Languages

Language:Go 81.8%Language:Makefile 18.2%