sysmgr is a service manager that aims to do as little as possible for service supervision. It can be viewed as a simplified version of runit. It only cares about making sure certain processes are alive unless explicitly stopped. Unlike runit, it doesn’t care about logging, or stopping daemons with special commands, as those can easily be handled by service scripts themselves. It doesn’t have supervise directories with FIFOs inside. It ONLY cares about processes and nothing else.

Interacting with sysmgr

While sysmgr can be interacted entirely with POSIX base tools, sysmgr provides a tool named ‘svctl’ for interacting with sysmgr. This tool can be used to check the status and start/stop/restart services.

When sysmgr picks up a service script inside the service directory, it automatically starts the service unless stopped.

Details of implementation

The initial implementation of sysmgr was written in POSIX shell, and it used POSIX compliant base-tools, however, in order to spawn as little processes as possible, it did some Linuxisms which prevented portability. The current implementation is written in C99, and it only uses functions from the POSIX-2008 C Library, so it should work on all POSIX-compatible systems. Testing required.

Building and installing

Before building sysmgr, it is best to take a look at the config.h and files, and modify them to fit your system. Afterwards you can do the following (as root if necessary):

make install

You can then install service scripts to your service directory and run sysmgr.

Service scripts

Service scripts can be any executable ranging from shell scripts to C binaries. The only requirement is that they can be executable. An example script is as follows:

#!/bin/sh -e
exec httpd -f -p 8080 -h /var/pub/www

The exec call in the shell script makes sure that sysmgr is tracking the process id of the httpd program rather than the shell script. It isn’t necessary, but it is the best practice to do so.

On certain occasions a service can depend on other services to be able to start. That’s why a sysmgr-depends tool is supplied, in order to make sure a service can wait until another service is up.

#!/bin/sh -e
sysmgr-depends dbus
exec NetworkManager -n

More information

More usage information can be found on the following manual pages:

This page in plain-text