Service Directory

A service directory may contain the following:

run

A file run which contains the executable and the arguments to run the service. It is read and the process described in the contents are started every time the service must be started.

Note

  • The startup location for the executable will be the service directory itself.
  • Environment variable substitution will be performed on the process described by run before executing. Additional environment variables can be created as mentioned below.

finish

An optional finish file which will run after the run process has finished. By default, the finish process must do its work and exit in less than 5 seconds; if it takes more than that, it is killed. The maximum duration of a finish execution can be configured via the timeout-finish file mentioned below.

Note

Similarly with run, environment variables will be substituted with the addition of SUPERVISE_RUN_EXIT_CODE which has the exit code of the run process. Additional environment variables mentioned below will also be available to the finish process.

supervise

A directory named supervise, which is automatically created by winss-supervise.exe to store its information. This directory must be writable.

down

An optional, empty file down, which if exists will make the default state down and not up such that when winss-supervise.exe starts then the run process will not be started until signaled using winss-svc.exe -u.

timeout-finish

An optional file timeout-finish which contains an unsigned integer that is the maximum number of milliseconds after which the finish process can execute for. It will be terminated after this period has expired. A value of 0 allows the finish process to run forever.

env

An optional directory named env which contains files that represent the environment variable names and their contents are the values of the environment variables. For example a file named env/USER with the contents foo would be USER=foo when running a process. Like the contents of run and finish, the values can be substituted with current environment variables. Using this you can append to the PATH rather than overwriting it.

Multiple env dirs are supported if you make env a file and put the paths to each env dir into the file separated by a new line.

log

An optional service directory named log, which if exists and winss-supervise.exe is started by winss-svscan.exe, then the winss-svscan.exe process will start an additional winss-supervise.exe on the log service directory with the standard input piped from the standard output of the former winss-supervise.exe process. For example if the service foo has a log folder then both foo and foo/log will be supervised and the output of foo will be sent to the input of foo/log. Typically winss-log.exe can be used to log although not necessarily.

Warning

There may be additional files/directories which will be used by winss-supervise.exe in the future. The only file/directory which is guaranteed never to be used by winss-supervise.exe is data. It is therefore recommended that any specific application data in that file/directory.