<<

NAME

pf::services::manager

DESCRIPTION

pf::services::manager

This module encapsulates the service actions/commands for pfcmd tool

EXAMPLES

An example of a new service foo

    package pf::services::manager::moo;

    use strict;
    use warnings;
    use Moo;

    extends 'pf::services::manager';

    has '+name' => ( default => sub { 'foo' } );

    has '+launcher' => (default => sub { '%1$s -d' } );

To include the new service in pfcmd service

* Add service name to the service regex in pf::pfcmd

* Update the help in pf::pfcmd::help

Attributes

name

name of service

shouldCheckup

if service requires checkup

launcher

sprintf-formatted string that control how the services should be started %1$s: is the service executable %2$s: optional parameters

dependsOnServices

services that this service needs in order to start

executable

executable of service

lastPid

The last pid retrived from the pidFile

inotify

The inotify object used to watch for pidfile

isvirtual

If the service is a virtual service

forceManaged

If set then the service is forced to be considered managed

Methods

_build_inotify

builds the inotify object

start

start the service

preStartSetup

work for starting a servicw

startService

Starts the service

postStartCleanup

Cleanup work after the starting the service

_setupWatchForPidCreate

This setups a watch on the run directory to wait for the pid to

_build_executable

the builder the executable attribute

restart

restart the service

status

returns the pid or list of pids for the servie(s)

pid

Returns the pid of the service

stop

Stop the service waitinf for it to shutdown

preStopSetup

the pre stop setup

stopService

postStopCleanup

watch

If the service is stopped start the service

generateConfig

generates the configuration files for the service

launchService

launch the service using the launcher and arguements passed

_cmdLine

TODO: documention

_cmdLineArgs

TODO: documention

pidFile

return the pid file of the service

pidFromFile

get the pid from the pid file

removeStalePid

removes the stale PID file

isAlive

checks if process is alive

isManaged

return true is the service is currently managed by packetfence

AUTHOR

Inverse inc. <info@inverse.ca>

COPYRIGHT

Copyright (C) 2005-2015 Inverse inc.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

<<