NAME
Svsh - Process supervision shell for daemontools/perp/s6/runit (base class)
SYNOPSIS
package Svsh::SomeSupervisor;
use Moo;
use namespace::clean;
with 'Svsh';
# implement required methods
DESCRIPTION
svsh
is a shell for process supervision suites of the daemontools
family, including perp
, s6
and runit
. Refer to svsh for documentation of the shell itself. This file documents the base class for Svsh adapter classes.
ATTRIBUTES
basedir
Required, Read-Only.
The base directory from which the process supervisor is managing services.
bindir
Read-Only.
The directory where the process supervisor's tools are located. Any call to the supervisor's tools will be prefixed with this path if provided. For usage in case the tools are not in the running user's PATH
environment variable.
collapse
Read-Write.
A boolean indicating whether the collapse option should be enabled.
statuses
Read-Only.
A hash-ref of services and their statuses (this is automatically populated by the respective status()
method in the adapter classes. For every service, a hash-ref with status
, duration
and pid
keys should exist.
REQUIRED METHODS
status()
Finds all services managed by the supervisor, and populates the statuses attribute.
start( @services )
Starts a list of services if they are down.
stop( @services )
Stops a list of services (should not restart them).
restart( @services )
Stops and starts a list of services. Generally, this is implemented with a QUIT
signal to the services, but check with the specific adapter class.
signal( $signal, @services )
Sends UNIX signal to a list of services.
fg( $service )
Finds the log file to which a service is writing, and displays it on screen with the tail -f
command.
WANTED METHODS
These methods are not required by adapter classes. If they are not implemented, they will be unavailable in the shell.
rescan()
Causes the supervisor to rescan the service directory to find new or removed services.
terminate()
Terminates the supervisor. Should also terminate all running services.
METHODS
run_cmd( $cmd, [ @args ] )
Runs a shell command with zero or more arguments and returns its output. If the bindir
attribute is set, and the $cmd
is one of the supervision suite's library of tools, $cmd
will be prefixed with bindir
.
find_logfile( $pid )
Finds the log file into which a logging program is currently writing to. $pid
is the process ID of the logging program. Currently, tinylog
, s6-log
, svlogd
and multilog
are supported.
Returns undef
if the file is not found.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-Svsh@rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Svsh.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Svsh
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
AUTHOR
Ido Perlmuter <ido at ido50 dot net>
LICENSE AND COPYRIGHT
Copyright (c) 2015, Ido Perlmuter ido at ido50 dot net
.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either version 5.8.1 or any later version. See perlartistic and perlgpl.
The full text of the license can be found in the LICENSE file included with this module.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.