yast2 |
modules/Service.ycp |
Service manipulation | |
|
|
This module has an unstable interface. |
Functions for service (init script) handling used by other modules.
StructuresGlobal Functions
Local VariablesLocal Functions |
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>
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 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 ($[])
Call insserv -r and record errors. Does not check if it exists
- Parameters:
-
name service name force pass "-f" to insserv (workaround for #17608, #27370)
- Return value:
-
success state
Adjust runlevels in which the service runs.
- Parameters:
-
name service 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.
- Parameters:
-
name name of service to adjust rl list of runlevels in which service should start
- Return value:
-
success state
Check if service is enabled
Returns true if any link in /etc/init.d/rc?.d/ exists for this script. If service does not exist, logs an error.
- Parameters:
-
name service name
- Return value:
-
true if service is set to run in any runlevel
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 return output
- 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