s6-rc
Software
skarnet.org

The s6-rc-db program

s6-rc-db is a tool to analyze a compiled service database and extract information from it, and print it in a user-friendly format.

It is an offline tool, i.e. you can run it on any compiled service database without actually having a live set of services managed by s6-rc. However, if you do have a live set, you can still run s6-rc-db on the current database (and it is the default); it won't interfere with your normal service operation.

Interface

     s6-rc-db help
     s6-rc-db [ -l live ] [ -c compiled ] check
     s6-rc-db [ -l live ] [ -c compiled ] list all|services|oneshots|longruns|bundles
     s6-rc-db [ -l live ] [ -c compiled ] type servicename
     s6-rc-db [ -l live ] [ -c compiled ] [ -u | -d ] timeout atomicname
     s6-rc-db [ -l live ] [ -c compiled ] contents bundlename
     s6-rc-db [ -l live ] [ -c compiled ] [ -u | -d ] dependencies servicename
     s6-rc-db [ -l live ] [ -c compiled ] servicedir longrunname
     s6-rc-db [ -l live ] [ -c compiled ] [ -u | -d ] script oneshotname
     s6-rc-db [ -l live ] [ -c compiled ] flags atomicname
     s6-rc-db [ -l live ] [ -c compiled ] atomics servicename...
     s6-rc-db [ -l live ] [ -c compiled ] [ -u | -d ] all-dependencies servicename...

Options

Subcommands

s6-rc-db help

Prints a help message on stdout.

s6-rc-db check

Checks the database consistency. Exits 4 with an error message if it finds a problem, such as a mismatch in the direct and reverse dependency tables, or a dependency cycle.

s6-rc-db list

Lists all services of a given type. This subcommand takes a second subcommand:

s6-rc-db list all

Lists everything - atomic services and bundles - contained in the database.

s6-rc-db list services

Lists all atomic services.

s6-rc-db list oneshots

Lists oneshots.

s6-rc-db list longruns

Lists longruns.

s6-rc-db list bundles

Lists all bundles.

s6-rc-db type servicename

Prints the type of servicename: oneshot, longrun or bundle. Exits 1 if servicename is not a valid identifier in the database.

s6-rc-db timeout atomicname

Prints the timeout value, in milliseconds, after which bringing atomicname up or down is considered a failure if the called script still has not succeeded. Exits 1 if atomicname isn't a valid atomic service. By default, or if the -u option has been given to s6-rc-db, the timeout for up is printed; the timeout for down is printed instead if the -d option has been given.

s6-rc-db contents bundlename

Lists the atomic services represented by bundle bundlename. Exits 1 if bundlename is not a valid bundle.

s6-rc-db dependencies servicename

Prints the list of direct dependencies for servicename. Exits 1 if servicename isn't a valid identifier. If servicename is a bundle, its set of direct dependencies is the union of the direct dependencies of all the atomic services contained in the bundle.

If the -d option has been given to s6-rc-db, the reverse dependencies are given instead: services that directly depend on servicename, or on one of its components if it is a bundle.

s6-rc-db servicedir longrunname

Prints the service directory for longrun service longrunname; this value is relative to the scandir. Exits 1 if longrunname is not a valid longrun.

s6-rc-db script oneshotname

Prints the up script for oneshotname, which is an argv, i.e. a Unix command line. Each component of this command line is terminated by a null character, so to print it in a human-readable format, pipe the output into something like xargs -0 echo. The command exits 1 if oneshotname is not a valid oneshot.

If the -d option has been given to s6-rc-db, the down script is printed instead.

s6-rc-db flags atomicname

Prints a hexadecimal number that is the list of all binary flags for atomic service atomicname. Exits 1 if atomicname is not a valid atomic service.

Those binary flags are currently unused, but this may change in a future version of s6-rc.

s6-rc-db atomics servicename...

Prints the fully resolved list of services represented by the servicename... arguments, i.e. the union of all atomic services contained in servicename.... Each argument in servicename... can be an atomic service or a bundle. If an argument isn't a valid identifier, the command exits 1.

s6-rc-db all-dependencies servicename...

Prints the list of all atomic services needed to bring up all of the servicename... arguments, with all their dependencies, recursively. In other words: for servicename... to be up, every single service listed in the output will need to be up. The output includes the atomic services represented by the servicename... arguments themselves. If one of those arguments isn't a valid identifier, the command exits 1.

The list is not topologically sorted.

If the -d option has been given to s6-rc-db, the recursive list of reverse dependencies is printed: for servicename... to be down, every single service listed in the output will need to be down.