Software Service Manager, also known as ssm
or ssmctl
is an alternative
to systemd and supervisord, allowing the configuration & management of services
with the use of .service
files located under /etc/ssm
This software works
great for containerized software and or systems that simply don't like systemd.
This part of the README will contain basic documentation on how to write and configure your own service to run.
Service files also files that ends with .service
are going to have to be located
under /etc/ssm
for ssm to identify and register services. This means to manually
or automatically register a service simply requires a .service
file to be created
in /etc/ssm
with the file name being the service name, for example
/etc/ssm/htop.service
will allow you to run commands such as ssmctl start htop
If the main ssm
process is running, it will automatically detect changes and apply
it accordingly. If the service is already running, changes will not be applied until
the service restarts.
The format of a .service
file is simply a INI file format and this part of the
documentation will explain what sections can be configured, and examples. The options
provided by ssm
are similar to what systemd
provides.
A lunch condition is applied to many sections of the file that you can optionally add,
this includes the main start
condition that represents the main execution point of
your service configuration, there can be many other lunch conditions that can be
executed for example before and after your start
condition runs, or before and after
restart and stop conditions. Allowing you to fully customize and handle the service
execution flow. Below is a table of options that a Launch Condition section can consist
of but note that some options may only be applicable to start
and other lunch
conditions. Not all options are required.
Parameter | Example Value | Default Value | Description |
---|---|---|---|
Exec | /usr/bin/htop |
null |
The main execution point of the lunch condition |
Args | GIT_API_KEY=Hello!:TEST_PARTY=netkas\:netkas |
null |
Command-line Arguments to pass on to the execution point, separated by : to escape the separator use \: , in this example the following arguments are passed: GIT_API_KEY=Hello! & TEST_PARTY=netkas:netkas |
Env | GIT_API_KEY=Hello!:TEST_PARTY=netkas\:netkas |
null |
Environment variables to apply to the execution point, separated by : , to escape the separator use \: , in this example the following arguments are passed: GIT_API_KEY=Hello! & TEST_PARTY=netkas:netkas |
Cwd | /usr/bin |
null |
The working directory that the process should be running in if configured |
Restart | always |
on-failure |
Configures whether the executed process shall be restarted when the process exits, is killed, or a timeout reached. Takes one of the no , on-success , on-failure , unless-stopped or always . no Means the process will not automatically restart for any reason whatsoever. on-failure will only restart if the process's lunch condition indicates failure. unless-stopped will always restart the process unless stopped manually this is only applicable to the start lunch condition. always will always restart the process, this is only applicable to the start lunch condition. |
MaxFailureRestarts | 3 |
infinity |
If Restart is configured to always or on-failure , this indicates how many times can the process restart due to failure conditions before it is considered failed and stops the service. |
MaxAutomaticRestarts | 3 |
infinity |
If Restart is configured to alyways or on-success or and if MaxFailureRestarts is set to infinity this indicates how many times the process can restart due to failure and or success conditions before it is considered failed and stops the service. |
TimeoutStartSec | 60 |
infinity |
ONLY APPLICABLE TO start 's lunch condition. Indicates the time to wait for a start-up, this is conditioned by other lunch parameters such as start_pre where if the pre conditions are not completed within the configured time (seconds) then the service will be considered failed and shutdown again. |
TimeoutStopSec | 60 |
infinity |
ONLY APPLICABLE TO start 's lunch condition. Indicates the time to wait for the shutdown, this is conditioned by other lunch parameters such as stop_pre & stop_post and including the main shutdown process of start , where if all condtions fails to exit or finish executing during the configured time (seconds) then the service will be considered failed and forced to shutdown. |
RuntimeMaxSec | 60 |
infinity |
Configured the maximum time for a service to run, if this is used and the process has been active for longer than the specified time then it will be terminated and put into a failure state, this value's unit is in seconds. |
SuccessExitStatus | 0 75 250 |
0 75 250 |
Takes a list of exit status codes that, when returned by the executed process, will be considered a successful termination, in addition to the normal successful exit status 0. These exit codes are separated by spaces and only accepts integers, anything else will be ignored. |
ErrorExitStatus | 1 |
1 |
Takes a list of exit status codes that, when returned by the executed process will be considered an error, in addition to the the exit code 1. These exit codes are separated by spaces and only accepts integers, anything else will be ignored. |
RestartPreventExitStatus | 1 |
null |
Takes a list of exit status codes that, when returned by the executed process will prevent automatic service restarts, regardless of the restart setting configured with Restart , these exit codes are separated by spaces and only accepts integers, anything else will be ignored. |
RestartForceExitStatus | 1 |
null |
Takes a list of exit status definitions that, when returned by the executed process will force automatic service restarts regardless of the restart setting configured with Restart , these exit codes are separated by spaces and only accepts integers, anything else will be ignored. |
LogStdout | true |
true |
Indicates if the standard output from this executed process should be logged or ignored, this only accepts true or false as a value. Logging is configured globally with in logging section of the service's configuration file. |
LogStderr | true |
true |
Indicates if the standard error output from this executed process should be logged or ignored, this only accepts true or false as a value. Logging is configured globally with in logging section of the service's configuration file. |