NAME
Ubic::Cmd - ubic methods with pretty printing.
VERSION
version 1.13
SYNOPSIS
use Ubic::Cmd;
Ubic::Cmd->start("aaa.bbb");
SYNOPSIS
When using ubic from simple scripts, you want to print some output about what happened when starting/stopping service.
This package mostly conforms to Ubic
module API (i.e. to LSB init-script API).
It also greatly simplifies writing /etc/init.d/ scripts (see synopsis).
CONSTRUCTOR
- new($params)
-
All methods of this class can be invoked as class methods, but you can construct your own instance if neccesary (although constructor doesn't have any options by now, so it is useless).
LSB METHODS
All following methods do the same things as methods in Ubic
, but they also print messages about their actions.
- start($service)
- stop($service)
- restart($service)
- try_restart($service)
- reload($service)
- force_reload($name)
OTHER METHODS
- do_custom_command($service, $command)
-
Do non-LSB command.
- usage($command)
-
Print command's usage.
WARNING: exits on invocation!
- traverse($name, $callback)
-
Process each subservice of
$name
with$callback
, printing correct indentations. - print_status($name, $cached_flag)
- print_status($service, $cached_flag)
-
Print status of given service identified by name or by object. If
$cached_flag
is true, prints status cached in watchdog file. - run($params_hashref)
-
Run given command for given service and exit with LSB-compatible exit code.
Parameters:
- name
-
Service's name or arrayref with names.
- command
-
Command to execute.
- force
-
Force command on protected multiservice.
BUGS AND CAVEATS
Interface of this class is unstable and can be changed without further notice.
When in doubt, consider Ubic or system("ubic COMMAND SERVICE") instead.
AUTHOR
Vyacheslav Matjukhin <mmcleric@yandex-team.ru>