Ubic::Cmd - ubic methods with pretty printing.
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).
use Ubic::Cmd;
Ubic::Cmd->start("aaa.bbb");
- new($params)
- All methods of this class can be invoked as class methods, but you can
construct your own instance if necessary (although constructor doesn't
have any options by now, so it is useless).
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)
- do_custom_command($service, $command)
- Do non-LSB command.
- usage($command)
- Print command's usage.
WARNING: exits on invocation!
- traverse($name_or_service, $callback)
- Process each subservice of $name_or_service with
$callback, printing correct indentations.
- print_status($name, $force_cached)
- print_status($name, $force_cached,
$results)
- Print status of given service identified by name or by object.
If $force_cached is true, prints
status cached in watchdog file. Otherwise, check for real status if
current user is root or if current user is equal to service
user.
- 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.
Interface of this class is unstable and can be changed without further notice.
When in doubt, consider Ubic or system("ubic COMMAND
SERVICE") instead.
Vyacheslav Matyukhin <mmcleric@yandex-team.ru>
This software is copyright (c) 2015 by Yandex LLC.
This is free software; you can redistribute it and/or modify it
under the same terms as the Perl 5 programming language system itself.