Control to forked processes without pidfile feature.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Control for forked processes without save-pid-to-file feature.

Tool used feature of environment inheritance of forked process in linux to watching for it.

Getting started

To watching for your daemons you need to add it in bgctl file with prefix:

bgctl -- 


bgctl [-m marker] [-p pidfile] [-P prefix] [-k] -- <cmd> [cmd-args]
Arguments description:
-P <prefix>      - prefix used for processes grouping. Default: <empty>
-m <marker>      - used to by default it initialized with md5 hash of "<cmd> [cmd-args]".
                     A <marker> initialized with prefix "<prefix>_" if <prefix> isn't empty.
-p <pidfile>     - file to save PID of watched process. Default: /tmp/.<marker>.pid
-k               - kill the forked process. 
--               - tell to bgctl stop parsing arguments.

Usage examples

Control ssh with -f argument

bgctl -P SSHTUNNEL   -p /tmp/ -- /usr/bin/ssh -f -N -R username@

Alternative usage openconnect

bgctl -P OPENCONNECT      -- openconnect -b --no-cert-check