Taskmaster is a project that involves creating a process monitoring and control system similar to supervisord.
- Process Management: Start, stop, restart, shutdown
- Configuration File: Define processes and their behavior in a configuration file
- Status Monitoring: Real-time monitoring of process status
- Log Management: Comprehensive logging of process activities
The taskmaster project contains two binaries: taskmasterd and taskmaster
taskmasterd is the daemon which runs in background, and handles all the job control specified in the configuration file.
taskmaster is the client which permits you to communicate with the daemon
# Clone the repository
$> git clone [email protected]:sethquantix/taskmaster.git
$> cd taskmaster
# Compile the project
$> makeExample of a minimalist configuration file:
[taskmaster]
[jobs.setup]
cmd = "cp nginx.conf /tmp/nginx/nginx.conf"
num_procs = 1
autostart = false
auto_restart = "never"
[jobs.nginx]
cmd = "/usr/sbin/nginx -c /tmp/nginx/nginx.conf -g 'daemon off;'"
num_procs = 1
umask = "022"
working_dir = "/tmp/nginx"
stdout = "/tmp/nginx/nginx-{PID}.stdout"
stderr = "/tmp/nginx/nginx-{PID}.stderr"
exit_codes = "0..5"
autostart = false
auto_restart = "crash" # always|terminate|crash|never
start_retries = 15
start_time = 5
stop_signal = "SIGTERM"
stop_time = 10
env = { STARTED_BY = "taskmaster", ANSWER = "42" }
| Key | Description | Default | Values |
|---|---|---|---|
| socket | Unix socket path | "" | Path string |
| Key | Description | Default | Values |
|---|---|---|---|
| stdout | Stdout path | "/dev/pts/0" | Path |
| stderr | Stderr path | "/dev/pts/1" | Path |
| level | Log level | "Info" | "Debug", "Info", "Warn", "Error" |
| log | Enabled levels | All | Array of levels |
| Key | Description | Default | Values |
|---|---|---|---|
| cmd | Command to execute | String with arguments | |
| umask | File creation mask | 0o022 | u32 octal |
| working_dir | Working directory | "." | Path |
| num_procs | Process instances | 1 | Integer |
| stdout | Stdout path | "stdout" | Path |
| stderr | Stderr path | "stderr" | Path |
| exit_codes | Valid exit codes | "0..255" | Range(..), List(,), Single number |
| autostart | Auto start | false | Boolean |
| auto_restart | Restart policy | "never" | "always", "terminate", "crash", "never" |
| start_retries | Retry attempts | 0 | -1 (infinite), 0 (none), >0 |
| stop_signal | Stop signal | "SIGTERM" | Signal name |
| stop_time | Stop timeout | 10 | Seconds |
| aggregate | Aggregate logs | true | Boolean |
| env | Environment variables | Key={value pairs} |
| Key | Description | Default | Values |
|---|---|---|---|
| fg | Foreground color | Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, RGB | |
| bg | Background color | Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, RGB | |
| mode | Display mode | "Negative" | "Bold", "Faint", "Underline", "Blink", "Negative" |