
functions
files
intro
|
|
yast2 |
modules/Service.ycp |
| Service manipulation |
|
|
|
Functions for service (init script) handling used by other modules.
Structures
Global Functions
Local Variables
Local Functions
|
|
|
Structure service
One service is described by such map:
"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?
]
|
local error_msg -> string
|
|
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
|
local checkExists (string name) -> boolean
|
|
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. |
|
global Info (string name) -> map
|
|
Get service info without peeking if service runs.
- Parameters:
- Return value:
|
|
Service information or empty map ($[]) |
|
global Status (string name) -> integer
|
|
Get service status.
- Parameters:
- Return value:
|
|
init script exit status or -1 if it does not exist |
|
global FullInfo (string name) -> map
|
|
Get service info and find out whether service is running.
- Parameters:
- Return value:
|
|
service map or empty map ($[]) |
|
local serviceDisable (string name, boolean force) -> boolean
|
|
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:
|
global Adjust (string name, string action) -> boolean
|
|
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:
|
global Finetune (string name, list rl) -> boolean
|
|
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:
|
global Enabled (string name) -> boolean
|
|
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:
- Return value:
|
|
true if service is set to run in any runlevel |
|
global RunInitScript (string name, string param) -> integer
|
|
Run init script.
- Parameters:
|
name |
init service name |
|
param |
init script argument |
- Return value:
|
global RunInitScriptOutput (string name, string param) -> map
|
|
Run init script and return output
- Parameters:
|
name |
init service name |
|
param |
init script argument |
- Return value:
|
|
A map of $[ "stdout" : "...", "stderr" : "...", "exit" : int] |
|
global Enable (string service) -> boolean
|
|
Enable service
- Parameters:
|
service |
service to be enabled |
- Return value:
|
|
true if operation is successful |
|
global Disable (string service) -> boolean
|
|
Disable service
- Parameters:
|
service |
service to be disabled |
- Return value:
|
|
true if operation is successful |
|
global Start (string service) -> boolean
|
|
Start service
- Parameters:
|
service |
service to be started |
- Return value:
|
|
true if operation is successful |
|
global Restart (string service) -> boolean
|
|
Restart service
- Parameters:
|
service |
service to be restarted |
- Return value:
|
|
true if operation is successful |
|
global Reload (string service) -> boolean
|
|
Reload service
- Parameters:
|
service |
service to be reloaded |
- Return value:
|
|
true if operation is successful |
|
global Stop (string service) -> boolean
|
|
Stop service
- Parameters:
|
service |
service to be stopped |
- Return value:
|
|
true if operation is successful |
|
global Error () -> string
|
|
Error Message
- Return value:
|
|
error message from the last operation |
|