Ubic::Service - interface and base class for any ubic service
version 1.07
print "Service: ", $service->name; $service->start; $service->stop; $service->restart; $status = $service->status;
All ubic services must be subclasses of this package.
Action methods (like start, stop, reload) and status should return Ubic::Result::Class objects (usually constructed with result method from Ubic::Result).
start
stop
reload
status
result
Or they can return plain strings, Ubic will care about blessing them into result objects.
See "SEE ALSO" for references to more specific (and useful) versions of services.
Name of service.
Each service with the same parent should have an unique name.
In case of subservices, name should be the most lower-level name; use full_name method to get fully-qualified service name.
full_name
Fully qualified name of service.
Each service should have an unique full_name.
It is a concatenation of service's short name and service's <parent_name>.
name
Service's parent is responsible for setting it (to concatenation of it's own name and service's name) immediately after service's construction.
In case of subservices, initial name should be the most lower-level name; it will be concatenated with names of it's parents by it's parents. (See Ubic::Multiservice's code for more details).
Get/set name of service's parent.
Service's parent is responsible for calling it immediately after service's construction as $service->parent_name($self->full_name).
$service->parent_name($self->full_name)
Start service. Should throw exception on failure and string with operation result otherwise.
Starting already running service should do nothing and return "already running".
Stop service. Should throw exception on failure and string with operation result otherwise.
Stopping already stopped service should do nothing and return "not running".
Successful stop of a service must disable this service.
Check real status of service.
It should check that service is running correctly and return "running" if it is so.
Reload service, if possible.
Should return port number if service provides a server which uses TCP protocol.
Should return user from which the service can be controlled and will be running. Default is root.
root
Should return period of checking a service by watchdog in seconds.
Default is 60 seconds and it is unused by ubic-watchdog currently, so don't bother to override it by now :)
Can return list of service's custom commands, if such are exist.
Should execute specified command, if it is supported.
Ubic::Service::Skeleton - implement simple start/stop/status methods, and ubic will care about everything else.
Ubic::Service::Common - just like Skeleton, but all code can be passed to constructor as sub references.
Ubic::Service::SimpleDaemon - just give it any binary and it will make service from it.
Vyacheslav Matjukhin <mmcleric@yandex-team.ru>
To install Ubic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ubic
CPAN shell
perl -MCPAN -e shell install Ubic
For more information on module installation, please visit the detailed CPAN module installation guide.