Daemon build in Rust that controls the state of different applications according to the configuration received via REST JSON commands.
- Clone the repository and
cd
into it. - Run
cargo run
. - Send PUT requests to http://localhost:8000/commands with the body in the next format:
{
command: ["/path/to/executable", "argument1", "argument2"],
cwd: "/path/to/workdir",
state: "running"
}
state can be either running or stopped.
The supervisor will start a new process for any command in running state, or for a command in running state that was killed outside of the application. If a command state is changed from running to stopped, the process will be killed.
- Better error handling. Right now errors starting or killing processes will result in
panic
. - Refactor supervisor functionality outside of the
main
module. - Write unit and integration tests for the application.