Crates.io | psctl |
lib.rs | psctl |
version | 0.4.0 |
source | src |
created_at | 2023-03-19 16:34:59.509464 |
updated_at | 2024-08-10 21:16:04.655683 |
description | An operator for local processes |
homepage | |
repository | https://github.com/bww/psctl |
max_upload_size | |
id | 814517 |
size | 62,805 |
This is a simple process management tool. It runs processes as an interdependent graph.
You can think of Process Control as being like Docker Compose but for commands instead of containers. Or like Foreman but with support for process dependencies and availability checks.
(Process Control only works on Unix/Linux systems. It is tested on Linux and macOS.)
Install Process Control by downloading a release binary, or by using Homebrew on macOS:
$ brew install bww/stable/psctl
If you have a Rust toolchain installed, you can also install from crates.io:
$ cargo install psctl
Processes can have availability checks associated with them, which are used to determine when it has finished starting up and has become available. Processes can also describe which other processes are their dependencies. Using all this information, Process Control will:
Once any process exits, Process Control kills the other running processes and exits with the same exit code as the first exiting process.
The following process configuration file is illustrative:
version: 1
tasks:
-
name: a
run: sleep 3 && echo "A"
checks:
- https://hub.dummyapis.com/delay?seconds=2
- https://hub.dummyapis.com/delay?seconds=3
deps:
- b
- c
-
name: b
run: sleep 10 && echo "B"
checks:
- https://hub.dummyapis.com/delay?seconds=2
-
name: c
run: sleep 10 && echo "C"
checks:
- https://hub.dummyapis.com/delay?seconds=2
deps:
- b
It can be run as follows:
$ psctl --file test/example.yaml
====> b, c, a
----> b: sleep 10 && echo "B" (https://hub.dummyapis.com/delay?seconds=2)
----> c: sleep 10 && echo "C" (https://hub.dummyapis.com/delay?seconds=2)
----> a: sleep 3 && echo "A" (https://hub.dummyapis.com/delay?seconds=2; https://hub.dummyapis.com/delay?seconds=3)
A
====> finished
Notice that processes b
and c
are killed after a
exits normally, so they never echo anything.