Yet another service manager.
git clone https://github.com/fbt/watchman.git cd watchman make make install
BSD systems don't have /run as a tmpfs (or anything), so you would need to tell watchman where to keep runtime files
git clone https://github.com/fbt/watchman.git cd watchman make RUNDIR=/var/run/watchman make install
A service is a script in the watchman's init.d directory.
By default it's /etc/watchman/init.d for system services and $HOME/.watchman/init.d for user ones.
There are some variables you can use to alter a service's behaviour.
All of them are optional. Yes, I mean all of them.
$service_command # The service's executable. Watchman will try to find the service in $PATH by the service name, so yes, even this is optional. $service_args # Arguments to $service_command $service_respawn # Set this to start the service under a respawner (watchman-respawn). Note that you have two options here: 1) Make sure that the service doesn't daemonize. 2) Track the service by PID by specifically setting the $service_pidfile variable. $service_name # It is useful to set $service_name explicitly if you use a symlink to refer to a service and want to use both the original script and the symlink. $service_workdir # The directory to cd to before running $service_command $service_pidfile # The service's pid file. Will not be overwritten by watchman. By specifying this, you basically tell watchman that the service mantains its pidfile itself. $service_logfile # The file with $service_command's stdout/stderr. $service_actions # Array. Available service actions. Should not be overriden, only added to. If you need to remove an action, just do unset $action.
start() # Start the service. Calls watchman.start(). stop() # Stop the service. Calls watchman.stop(). restart() # Restart the service. Calls stop(), then start(). reload() # Reload the service's configuration. Calls watchman.reload, which sends SIGHUP to the service. status() # Show the service's status. Calls watchman.status(). depends() # Starts the specified services. Calls watchman.depends. logs() # Shows the service stdout log. Calls watchman.logs.