Unknown YCP Module |
This module has an unstable interface. |
File: modules/Service.ycp
Package: yast2
Summary: Service manipulation
Authors: Martin Vidner
$Id$
Structure service
One service is described by such map: <pre> "servicename" : $[ "defstart" : [ "2", "3", "5", ], // Default-Start comment "defstop" : [ "0", "1", "6", ], // Default-Stop comment "reqstart" : [ "$network", "portmap" ], // Required-Start comment "reqstop" : [ "$network", "portmap" ], // Required-Stop comment "description" : "text...", // Description comment "start" : [ "3", "5", ], // which runlevels service is really started/stopped in "stop" : [ "3", "5", ], // read from /etc/init.d/rc?.d/* links "started" : 0, // return from rcservice status (integer) "dirty" : false, // was the entry changed? ]</pre>
Unit locations for systemd
Init.d scripts location
After a function returns an error, this holds an error message, including insserv stderr and possibly containing newlines.
Set by checkExists: [Full]Info, Status, Enabled, Adjust, Finetune
Check that a service exists. If not, set error_msg.
- Parameters:
-
name service name without a path, eg. nfsserver
- Return value:
-
Return true if the service exists.
Get complete systemd unit id
- Parameters:
-
unit
- Return value:
-
(resolved) unit Id
Get the name from a systemd service unit id without the .service suffix
- Parameters:
-
name name or alias of the service
- Return value:
-
(resolved) service name without the .service suffix
Check if service is enabled (in any runlevel)
Forwards to chkconfig -l which decides between init and systemd
- Parameters:
-
name service name
- Return value:
-
true if service is set to run in any runlevel
Get service info without peeking if service runs.
- Parameters:
-
name name of the service
- Return value:
-
Service information or empty map ($[])
Get service status.
- Parameters:
-
name name of the service
- Return value:
-
init script exit status or -1 if it does not exist
Get service info and find out whether service is running.
- Parameters:
-
name name of the service
- Return value:
-
service map or empty map ($[])
Disables a given service and records errors. Does not check if it exists.
- Parameters:
-
name service name force pass "--force" (workaround for #17608, #27370)
- Return value:
-
success state
Adjusts runlevels in which the service runs.
- Parameters:
-
name action "disable" -- remove links, "enable" -- if there are no links, set default, otherwise do nothing, "default" -- set defaults.
- Return value:
-
success state
Set service to run in selected runlevels. Obsoleted - enables or disables the given service depending on the list of runlevels to start. If any runlevel is present, service is enabled, otherwise disabled.
- Parameters:
-
name name of service to adjust rl list of runlevels in which service should start
- Return value:
-
success state
Run init script.
- Parameters:
-
name init service name param init script argument
- Return value:
-
exit value
Run init script with a time-out.
- Parameters:
-
name init service name param init script argument
- Return value:
-
exit value
Run init script and also return its output (stdout and stderr merged).
- Parameters:
-
name init service name param init script argument
- Return value:
-
A map of $[ "stdout" : "...", "stderr" : "...", "exit" : int]
Enable service
- Parameters:
-
service service to be enabled
- Return value:
-
true if operation is successful
Disable service
- Parameters:
-
service service to be disabled
- Return value:
-
true if operation is successful
Start service
- Parameters:
-
service service to be started
- Return value:
-
true if operation is successful
Restart service
- Parameters:
-
service service to be restarted
- Return value:
-
true if operation is successful
Reload service
- Parameters:
-
service service to be reloaded
- Return value:
-
true if operation is successful
Stop service
- Parameters:
-
service service to be stopped
- Return value:
-
true if operation is successful
Error Message
- Return value:
-
error message from the last operation
Get list of enabled services in a runlevel
- Parameters:
-
runlevel requested runlevel number (0-6, -1 = Single)
- Return value:
-
enabled services
Return the first of the list of services which is available (has init script) or "" if none is.
- Parameters:
-
services
- Return value:
-
the first found service