=head1 NAME
aa-service - Helper for execline script to get service name/instance
=head1 SYNOPSIS
B<aa-service> [B<-D>] [B<-O> I<FILE|FD>] [B<-l>] I<PROG...>
=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.
B<Deprecation warning:> Note that this option has been deprecated and will be
removed in the next version; You should use B<--log-file> instead.
=item B<-h, --help>
Show help screen and exit.
=item B<-l, --log>
To use for a service logger run script, i.e. when current folder will be
subfolder I<log> of the servicedir.
=item B<-O, --log-file> I<FILE|FD>
Will duplicate all output (everything written to stdout or stderr) to the given
file or file descriptor. I<FILE|FD> can either be a (previously opened for
writing) file descriptor (must be > 2), or a file which will then be opened in
append mode.
=item B<-V, --version>
Show version information and exit.
=back
=head1 DESCRIPTION
This is a little helper for execline scripts (e.g. a service's I<run> script)
that will perform variable substitution on I<PROG...> for:
=over
=item B<SERVICE_NAME>
Will be the name of the current folder, i.e. full service name (e.g. I<foobar>
or I<bar@foo>)
=item B<SERVICE>
Will be the name of the service, without the instance name if any (e.g.
I<foobar> or I<bar>)
=item B<INSTANCE>
Will be the instance name of the service if any, else empty string (e.g. empty
string or I<foo>)
=back
This can be useful to get the service/instance name dynamicly; e.g. a service
could use I<${INSTANCE}> as argument, and a generic logger could then use
I</var/log/${SERVICE_NAME}> as logdir.
=head1 RETURN CODES
Return codes are somewhat unified inside B<anopa>. Odd return codes represent
fatal errors, and are detailled in B<anopa-rc>(1)
Possible even return codes for B<aa-service>(1) are:
=over
=item B<2>
Failed to perform variable substitution
=back