AA-STOP(1)

NAME
aa-stop - Stop services

SYNOPSIS
aa-stop [-D] [-r repodir] [-l listdir] [-a] [-k service] [-t timeout] [-n] [-v] [service...]

OPTIONS

-a, --all
    Stops all running/started services.

    Specify this option twice to enable "stop-all" mode, intended to bring down the entire supervised tree (i.e. be used during stage 3, after s6-svscan has been brought down). When used, you shouldn't specify any service on the command line.

    Also see below as well as --timeout for more implications.

-D, --double-output
    Enable double-output mode. Instead of using stdout for regular output, and stderr for warnings and errors, everything is sent both to stdout and stderr. This is intended to redirect stderr to a log file, so full output can be both shown on console and logged.

-h, --help
    Show help screen and exit.

-k, --skip service
    If service was asked to be stopped, silently ignore it. This is intended for use alongside --all --all to keep the catch-all logger service running as long as possible. Its s6-supervise will only be sent an 'x' command, so stopping the service next will automatically have its supervisor exit as well.

-l, --listdir dir
    Use dir to list services to start. Only one can be set, if specified more than once the last one will be used.

    If dir doesn't start with a slash or dot, it will be prefixed with /etc/anopa/listdirs/

-n, --dry-list
    Only print the name of the services, but do not stop anything.

-r, --repodir dir
    Use dir as repository directory. This is where servicedirs will be looked for.

-t, --timeout timeout
    Set default timeout to timeout seconds. You can use 0 for no timeout. Timeout can also be set in service in a file timeout in its servicedir.

    If the "stop-all" mode is enabled (i.e. option --all used twice), the default timeout (whether or not set on command line) will also be used as a maximum value.

-V, --version
    Show version information and exit.

-v, --verbose
    Print auto-added dependencies (from "needs"). Note that dependencies are "reversed" here, i.e. if foo needs bar, aa-stop(1) will print "bar needs foo" as to indicate that stopping bar needs to (first) stop foo.

    Also note that this will always print dependencies for all started services, whether or not they'll apply to the requested operation.

    This will be printed on stdout unless --dry-list was used, then it goes to stderr.

DESCRIPTION
aa-stop(1) allows to stop one or more services. It works in similar fashion to aa-start(1) but processing order and dependencies "in reverse" so to speak.

That is to say if service A was to be started after service B, then it will be stopped before B. And if A had a dependency (needs) on C, then stopping C will also cause for A to be stopped.

You can use - as service name to read actual service names from stdin, where there must be one name per line.

Refer to anopa(1) for descriptions of servicedirs and service dependencies.

aa-stop(1) works in a very similar manner as aa-start(1), with the following differences :

STOPPING A LONG-RUN SERVICE
aa-stop(1) will check if the service is running, and if not simply announce it as not up.

If the "stop-all" mode is enabled (i.e. option --all used twice), failing dependencies will not cause not to stop services. That is, is A needs B, stopping B would depend on stopping A first, and if that failed B wouldn't be stopped (Stopping failed: Failed dependency: A). However with this mode B would be stopped, as if A had been successfully stopped.

Additionally, aa-stop(1) will send command 'x' to s6-supervise of all down services, while it will send commands 'dx' (instead of 'd') to the up services' s6-supervise, so that after bringing their services down they exit as well. This is obviously all intended to bring the supervised tree all down, as is expected, and shouldn't be used if s6-svscan is still running (as it would bring the s6-supervise back up).

  Service not up
When you call aa-stop(1) it will first create a list of all services to be stopped. Any service specified that isn't up will simply be ignored with a "Not up" message shown.

It should be noted that, for long-run services, it is possible that a service was up then, but will be down by the time aa-stop(1) wants to stop it. E.g. because other services stopped first caused it to stop/crash.

In such a case, the message "Stopping service..." will be shown, and aa-stop(1) will send the command as usual; But it won't check for errors (nor wait for the 'd' event) and simply report the service as "Not up" instead.

This should ensure that e.g. s6 doesn't restart the service, or stops it if that was already (being) done.

STOPPING A ONE-SHOT SERVICE
Obviously, the script used is stop and not start. Other than that, the process is much the same, so you can refer to aa-start(1) for more.

BUGS
They're probably crawling somewhere in there... if you happen to catch one, (or more) report it and I'll do my best to squash it.

REPOSITORY
You can find the latest source code of anopa as well as report bugs and/or suggest features on its GitHub repository, available at <https://github.com/jjk-jacky/anopa>; or visit its official website at <https://jjacky.com/anopa>

AUTHOR

Olivier Brunel <jjk@jjacky.com>