This repository has been archived by the owner on Oct 16, 2022. It is now read-only.
udoprog/forkexec
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
RATIONALE: I got sick and tired of having to restart development processes which liked to hang alot by doing this: ps faux | grep "Whatever string that matches" kill <pid> This is dirty, does not retain a clean process state, and generally takes too much attention. Hacks that retain the pid in a seperate file are too various, and cumbersome to setup (at least when doing it a couple of times per day!). I know! Why not retain the pid in container process which is the bad-ass, control freak of a parent? ABOUT: Forkexec will run any type of process in a controlled environment governed by the forkexec Monitor Process. It is possible to communicate with this process and instruct it to perform tasks against the child process. USAGE: To install forkexec, run the following as a privileged user: #> python setup.py install This will install the command 'fex'. The first time you run fex you will be prompted for the FE_HOME environment variable. To change the variable temprorary, run: #> export FE_HOME=/usr/local/forkexec Note: you can pick any directory that is writable by your user. now try: #> fex And check the directory you specific directory, the structure will be something like: ./run ./init ./logs This is in the directory structure that forkexec preserves it's process states. If you add an executable to ./init, that contains: #!/bin/bash #contents of /usr/local/forkexec/init/netcat exec nc -l -p 32323 You will be able to start this program by running the command: #> fex start netcat Under your ./run directory, a file should have been created (specifically, a fifo): ./run/<uuid> To stop netcat, run: #> fex stop <uuid> In which netcat will be killed (SIGKILL) and the files under run will be removed. While running netcat, you might have noticed the following entry in your favorite process explorer (e.g. htop): <information> forkexec: Monitor Process (<uuid>) <information> `- nc -l -p 32323 netcat is directly parented by forkexec's Monitor Process which is what we control using the 'fex' command. This is all handled using the fifo's found under FE_HOME/run, so there, so there is no network involved. FEATURES: Current features are: - start processes (fex start <process>) - stop processes (fex stop <id>) - will automatically daemonize any process. - get pid and running time information about the child (fex info <id>) Future/Planned features are: - configurable stopping (e.g. choosing which signal combination to use). - handle stdin/stdout/stderr in a configurable manner. NOTES: - Do not even attempt to run real daemon's with fex, if possible you should not allow the child process to get into the background.
About
A development tool to tame wild processes
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published