Footprintless::Service - Performs an action on a service.
version 1.09
# Standard way of getting a service use Footprintless; my $service = Footprintless->new()->service(); $service->stop(); $service->start(); $service->status(); $service->kill();
Manages services. Allows you to start, stop, check the status of, and kill services. Additional actions can be configured as well.
A simple service (the most common case) can be defined:
service => { command => '/opt/foo/bar.sh', pid_file => '/var/run/bar/bar.pid' }
A more complex service might be defined:
service => { actions => { debug => {command_args => "jpda start"}, kill => {command_args => "stop -kill"}, status => {use_pid => 1, command_name => 'tomcat'}, }, command => '/opt/tomcat/catalina.sh', hostname => 'tomcat.pastdev.com', pid_command => 'ps -aef|grep "/opt/tomcat/"|grep -v grep|awk \'{print \$2}\'', sudo_username => 'tomcat', }
In this case, an additional action, debug, was added, kill was redefined as a special case of stop, and status was redefined to use the pid (ex: kill -0 $pid). Also, the pid is found via command rather than a file.
Constructs a new service configured by $entities at $coordinate. The supported options are:
$entities
$coordinate
The command options factory to use. Defaults to an instance of Footprintless::CommandOptionsFactory using the localhost instance of this object.
localhost
The command runner to use. Defaults to an instance of Footprintless::CommandRunner::IPCRun.
The localhost alias resolver to use. Defaults to an instance of Footprintless::Localhost configured with load_all().
load_all()
Executes $action on the service.
$action
Kills the service.
Starts the service.
Prints out the status of the service.
Stops the service.
Lucas Theisen <lucastheisen@pastdev.com>
This software is copyright (c) 2016 by Lucas Theisen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Please see those modules/websites for more information related to this module.
Footprintless
Config::Entities
Footprintless::CommandOptionsFactory
Footprintless::CommandRunner
Footprintless::Localhost
To install Footprintless, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Footprintless
CPAN shell
perl -MCPAN -e shell install Footprintless
For more information on module installation, please visit the detailed CPAN module installation guide.