=head1 NAME

aa-setready - Set a service (un)ready

=head1 SYNOPSIS

B<aa-setready> [B<-D>] [B<-U> | B<-N>] I<SERVICEDIR>

=head1 OPTIONS

=over

=item B<-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.

=item B<-h, --help>

Show help screen and exit.

=item B<-N, --unready>

Mark the service unready and emit event 'N' on I<event> fifodir.

=item B<-U, --ready>

Mark the service ready and emit event 'U' on I<event> fifodir. This is the
default.

=item B<-V, --version>

Show version information and exit.

=back

=head1 DESCRIPTION

B<aa-setready>(1) is a simple tool to mark a long-running service ready or
"unready".

Marking a service ready or unready means updating its s6 status file, and
emitting the corresponding event on the service's fifodir I<event>.
Unreadiness is meant for service that can stay up (running) but lose their ready
state (e.g. connection dropped).

Obviously you need to have the appropriate permissions to perform all the needed
tasks.

=head1 RETURN VALUE

B<aa-setready>(1) will return 0 on success, or one of the following on error:

=over

=item B<1>

Syntax error (e.g. unknown option)

=item B<2>

Failed to read s6 status file

=item B<3>

Service is not up

=item B<4>

Failed to init timestamp (needed for readiness timestamp, when marking ready)

=item B<5>

Failed to write s6 status file

=item B<6>

Failed to sent the event on I<event> fifodir

=back
