NAME

lcfg-service - Call service actions in a platform-independent way

VERSION

This documentation refers to lcfg-service version 1.20.8

USAGE

lcfg-service [--timeout seconds] [--debug] service_name action_name args

DESCRIPTION

This script can be used to run service actions in a platform-independent way. A service is typically a daemon, such as httpd, sshd or crond, for which there are various actions which can be applied (e.g. stop, start, status). Historically in the SysVinit era these actions were called by running a script in /etc/init.d, recently this was done using the service command and now with Systemd they are executed using systemctl. It is useful to be able to call an action from a script without needing to encode any knowledge of which system is being used on a particular platform. On LCFG managed systems all the necessary information is already available in the sysinfo component resources. This tool uses the LCFG::Utils::Service module to query the sysinfo information and execute the required command in the appropriate way for the current platform.

REQUIRED ARGUMENTS

The service name (e.g. httpd, sshd, crond) and the action name (e.g. stop, start, status) must both be specified.

OPTIONS

timeout

This option can be used to set the integer number of seconds to wait for the command to run. If the timeout is exceeded then the script will fail and exit with status 253. The default timeout is 10 minutes.

debug

This option can be used to enable useful debugging messages to be printed to stderr.

help

This option causes the usage documentation to be printed to the screen.

CONFIGURATION

The configuration for this tool comes from the LCFG sysinfo component resources. They are used to select the correct init-tool (e.g. service or systemctl) for the current platform.

EXIT STATUS

If there is a usage error this script will exit with a status of 254. If there is a error running the command this script will exit with a status of 253. Otherwise, if the command completes the script will exit with the status of the command.

DEPENDENCIES

Most of the functionality of this script is provided by the LCFG::Utils::Service module. This script also requires Try::Tiny.

SEE ALSO

LCFG::Utils::Service, LCFG::SysInfo, lcfg-sysinfo(8)

PLATFORMS

This is the list of platforms on which we have tested this software. We expect this software to work on any Unix-like platform which is supported by Perl.

ScientificLinux6, EnterpriseLinux7, MacOSX

BUGS AND LIMITATIONS

Please report any bugs or problems (or praise!) to bugs@lcfg.org, feedback and patches are also always very welcome.

AUTHOR

Stephen Quinney <squinney@inf.ed.ac.uk>, Paul Anderson <dcspaul@inf.ed.ac.uk>

LICENSE AND COPYRIGHT

Copyright (C) 2015 University of Edinburgh. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GPL, version 2 or later.