Linux: start another process when a given one exits; send sigstop to certain processes as they execute; ...

fnordomat b743bb6f00 fixed some mistakes 5 gadi atpakaļ
src b743bb6f00 fixed some mistakes 5 gadi atpakaļ
.gitignore 9b0d70da6a Initial commit 5 gadi atpakaļ
LICENSE 9b0d70da6a Initial commit 5 gadi atpakaļ
Makefile.am 423e2bb015 added automake 5 gadi atpakaļ
README.md 423e2bb015 added automake 5 gadi atpakaļ
configure.ac a6e9fad2a0 very crude argument parsing for "run" action 5 gadi atpakaļ

README.md

Upon

This is work in progress.

Start one process when another (specified by PID) quits, or perform an action when a process whose commandline begins with a given prefix starts. The action can be: trigger another command or send the new process a SIGSTOP as soon as it is detected.

Prequisites

Linux with CONFIG_CONNECTOR=y CONFIG_PROC_EVENTS=y configured.

Build

touch config.rpath
autoreconf -iv
./configure --prefix=/usr/local
make

Usage

upon exec m"xyz" "run abc"
upon exit p4711 "run abc"
upon -vv exec m"/usr/lib/firefox/firefox" sigstop

See also

[SO Q 6075013](https://stackoverflow.com/questions/6075013/how-to-detect-the-launching-of-programs-on-linux_

Acknowledgments

Thanks to the various people who shared their "cn_proc" C code under FLOSS licenses.

TODO

Make sure it is as safe as it can be. Identify and implement missing features (regex matching; command line arguments for the "run" action). More testing. Improve the code. Optimize.