GPM is an extremely lightweight process manager.
It's easy to configure and has no external dependencies, making it an obvious choice for contains.
GPM runs on any Platform, not just Linux or Windows.
GPM comes with a pretty short list of core features:
Automatically restart a process whenever it dies.
Have a setup script that needs to run before other process can run? Just have them depend on each other, and GPM will handle the rest
GPM will pass along interrupts, and give child processes a chance to shutdown. Are they not down after 7 seconds, then they will be force killed.
All output to stdout/stderr from child-processes will appear in GPM's stdout/stderr, allowing for better log tailing when running in contains, or simply for easier overview.
GPM attempts to keep the configuration to a minimum, however some configuration is required for GPM to be able to figure out what processes should be run.
Make a file config.json
where you want to run GPM from.
An extremely simply configuration file, that just runs an echo command once looks like this:
[
{
"name": "echo",
"command": "echo 'this is a test'"
}
]
Here is a table of all the possible options per process.
Key | Description | Required |
---|---|---|
name |
This is the name of the process, used when resolving dependencies, and for writing to the log. | Yes |
command |
This is the actual terminal command to run. Write here exactly like you would on your normal terminal. Does not support piping between processes. | Yes |
autoRestart |
Set to true to have the process automatically be restarted when it closes. Mutually exclusive with after |
No |
after |
The name of the process, this process should be run after. Mutually exclusive with autoRestart |
No |
workDir |
The working directory of the process when executed | No |
A more involved example:
[
{
"name": "echo",
"command": "echo 'this is a test'"
},
{
"name": "gfs",
"command": "gfs-windows-x64.exe",
"autoRestart": true,
"after": "echo"
},
{
"name": "echo2",
"command": "echo 'this is echo 2'",
"after": "echo"
},
{
"name": "echo3",
"command": "echo this is echo 3",
"after": "echo2"
}
]
This starts a single echo process that write 'this is a test'
to the terminal.
Then it starts a GFS process.
At the same time another echo process is started, writing 'this is echo 2'
to the terminal.
Then yet another echo process start, that write 'this is echo 3'
to the terminal.
Should the GFS process ever stop, then GPM will handle starting it again.