Table of Contents

Currently viewing version: 0.8.0.0

scandir

Handles the scandir for a given user. Designed to be either root or a branch of the supervision tree(nested scandir).

Interface

scandir [ -h ] [ -o owner ] create|start|stop|remove|reconfigure|check|quit|abort|nuke|annihilate|zombies [<subcommand options>]

This program creates, removes or sends a signal to a scandir (directory containing a collection of s6‑supervise processes) for the current owner of the proccess depending on the provided options.

When the start subcommand is invoked, this command launches the s6-svscan, responsible for supervising the s6-supervise program, where s6-supervise monitors a single service.

Options

Subcommands

Usage examples

Creates a scandir for the owner of the process

66 scandir create

Creates a scandir for the owner owner

66 scandir -o owner create

Creates a scandir for a boot process

66 scandir create -b

Creates a scandir for the boot process using the specific account logaccount for the logger

66 scandir create -b -L logaccount

Creates (if doesn't exist yet) and starts a scandir for the boot process within a container adding an extra environment directory called /myenvdir.

66 scandir start -B -e /myenvdir

Stops an already running scandir

66 scandir stop

create

This subcommand create a scandir.

Interface

scandir create [ -h ] [ -b|B ] [ -c ] [ -L log_user ] [ -s skel ]

This command create the necessary directory at /run/66. If the scandir already exist for the given user it will prevent its creation. You must remove it first if you don't want to keep it.

Various files and directories is created at /run/66. Refers to deeper understanding documentation for futhers information.

Options

Usage examples

Creates a scandir for the owner of the process

66 scandir create

Creates a scandir for the boot process using the specific account logaccount for the logger

66 scandir create -b -L logaccount

start

This subcommand starts a scandir and, if it doesn't exist yet, it possibly creates it .

Interface

scandir start [ -h ] [ -d notif ] [ -s rescan ] [ -e environment ] [ -b|B ]

The scandir is created if it wasn't made previously, but you don't a fine-grained control over its creation as you do with the create subcommand.

Options

Usage examples

Starts a scandir with notify readiness mechanism on file descriptor 3

66 scandir start -d 3

Starts a scandir for the owner owner

66 scandir -o owner start

stop

This command stops a running scandir.

Interface

scandir stop [ -h ]

This command stops the scandir sending a SIGTERM to all the s6-supervise processes supervising a service and a SIGHUP to all the s6-supervise processes supervising a logger, then exec into its finish procedure. This means that services will be brought down but loggers will exit naturally on EOF, and s6-svscan will wait for them to exit before exec'ing into .s6-svscan/finish or exiting itself: it's a clean shutdown with no loss of logs.

Options

Usage examples

Stop an already running scandir

66 scandir stop

Stop an already running scandir for the owner owner

66 scandir -o owner stop

remove

This command remove a scandir from the live directory.

Interface

scandir remove [ -h ]

The scandir must first be stopped with scandir stop subcommand or similar subcommand to be able to remove it.

Certain directories within the scandir will not be removed. Specifically, /run/66/log, /run/66/scandir, and /run/66/state remain intact, whereas all UID subdirectories are deleted. Refers to deeper understanding for futhers information.

Options

Usage examples

Removes a scandir

66 scandir remove

Removes a scandir for the owner owner

66 scandir -o owner scandir

reconfigure

This command reconfigure a running scandir.

Interface

scandir reconfigure [ -h ]

s6-svscan will perform a scan, and destroy inactive services.

Options

Usage examples

Reconfigures a running scandir.

66 scandir reconfigure

Reconfigures a scandir for the owner owner

66 scandir -o owner reconfigure

check

This command check the scandir for services.

Interface

scandir check [ -h ]

s6-svscan will immediately perform a scan of scandir to check for services.

Options

Usage examples

Checks a scandir

66 scandir check

Checks a scandir for the owner owner

66 scandir -o owner check

quit

Quits a running scandir.

Interface

scandir quit [ -h ]

s6-svscan will send all its s6-supervise processes a SIGTERM, then exec into its finish procedure. This is different from stop subcommand in that services and loggers will be forcibly killed, so the quit procedure may be faster but in-flight logs may be lost.

Options

Usage examples

Quits a scandir running scandir.

66 scandir quit

Quits a scandir for the owner owner

66 scandir -o owner quit

abort

This command abort a running scandir.

Interface

scandir abort [ -h ]

s6-svscan will exec into its finishing procedure. It will not kill any of the maintained s6-supervise processes.

Options

Usage examples

Aborts a scandir

66 scandir abort

Aborts a scandir for the owner owner

66 scandir -o owner abort

nuke

Kill all the s6-supervise processes.

Interface

scandir nuke [ -h ]
s6-svscan kill all the s6-supervise processes it has launched but that did not match a service directory last time scandir was scanned, i.e. it prunes the supervision tree so that it matches exactly what was in scandir at the time of the last scan. A SIGTERM is sent to the s6-supervise processes supervising services and a SIGHUP is sent to the s6-supervise processes supervising loggers.

Options

Usage examples

Kill s6-supervise processes from a scandir

66 scandir nuke

Kill s6-supervise processes from a scandir for the owner owner

66 scandir -o owner nuke

annihilate

Annihilates a running scandir.

Interface

scandir annihilate [ -h ]

Does the same thing as nuke, except that SIGTERM is sent to all the relevant s6-supervise processes, even if they are supervising loggers. This is not recommended in a situation where you do not need to tear down the supervision tree.

Options

Usage examples

Annihilates a scandir

66 scandir annihilate

Annihilates a scandir for the owner owner

66 scandir -o owner annihilate

zombies

Destroy zombies from a running scandir.

Interface

scandir zombies [ -h ]

Immediately triggers s6-svscan's reaper mechanism.

Options

Usage examples

Removes zombies from a scandir

66 scandir zombies

Removes zombies from a scandir for the owner owner

66 scandir -o owner zombies

Boot specification

The -b, -B, -c and -s option are called by 66 boot. ‑b and -B will create .s6‑svscan control files (see s6‑svscan interface documentation) specifically for stage1 (PID1 process). This special scandir is controlled by 66 halt, 66 poweroff and 66 reboot command. The 66-shutdownd daemon which controls the shutdown request will be created automatically at the correct location. Further this specific task needs to read the skeleton file init.conf containing the live directory location which is the purpose of the ‑s option.

The live directory for the boot process requires writable directories and an executable filesystem. In order to accommodate for read‑only root filesystems there needs to be a tmpfs mounted before s6‑svscan can be run.

Environment

An Environment directory is a directory containing files with lines of pairs with the syntax being: key = value. The directory is parsed by ascending alphabetical order. If there are duplicate key=value pairs, the pair found in the last file takes precedence.

Whitespace is permitted before and after key, and before or after value.

Empty lines, or lines containing only whitespace, are ignored. Lines beginning with # (possibly after some whitespace) are ignored (and typically used for comments). Leading and trailing whitespace is stripped from values; but a value can be double-quoted, which allows for inclusion of leading and trailing whitespace.

Escaping double-quoted can be done with backslash \. For instance,

cmd_args=-g \"daemon off;\"

C escapes, including hexadecimal and octal sequences, are supported in quoted values. Unicode codepoint sequences are not supported.

If value is empty, key is still added to the environment, with an empty value.

Reusing the same variable or variable from the actual environment is allowed. In such case, variable name must be between ${} to get it value. For intance, an environment file can be declared

    PATH=/usr/local/bin:${PATH}
    socket_name=sname
    socket_dir=dname
    socket=${socket_dir}/${socket_name}

The order of key=value pair declaration do not matter

    PATH=/usr/local/bin:${PATH}
    socket=${socket_dir}/${socket_name}
    socket_name=sname
    socket_dir=dname

A variable calling itself is only allowed if the key name can be found at the environment of the current process. If the key of the key=value cannot not be found it left the pair as it. For intance,

    PATH=/usr/local/bin:${PATH}

will only works if PATH is already define at the current environment. If not the result will literally be PATH=/usr/local/bin:${PATH}.

Limits

An environment directory can not exceed more than 20 files. Each file can not contain more than 8191 bytes or more than 50 key=value pairs.