diff options
author | Cyril Hrubis <chrubis@suse.cz> | 2014-03-26 13:51:38 +0100 |
---|---|---|
committer | Cyril Hrubis <chrubis@suse.cz> | 2014-03-26 14:02:11 +0100 |
commit | 790407496b324fc7cc0b99c17c72ac0f82d420d9 (patch) | |
tree | 3d5e9979054d1dfe2e4d8f9c1b6336e87564145f /doc | |
parent | b44f410efc466d4eec7ed92bcee4ee799501a2e7 (diff) |
cmdlib.sh: Move daemon functions to daemonlib.sh
Move the daemon start/stop functions to separate daemonlib.sh library.
Add documentation to test-writing-guidelines
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/test-writing-guidelines.txt | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt index f637da65d..337a6a800 100644 --- a/doc/test-writing-guidelines.txt +++ b/doc/test-writing-guidelines.txt @@ -764,6 +764,56 @@ TST_CLEANUP=cleanup tst_exit ------------------------------------------------------------------------------- +2.3.4 Restarting daemons +^^^^^^^^^^^^^^^^^^^^^^^^ + +Restarting system daemons is a complicated task for two reasons. + +* There are different init systems + (SysV init, systemd, etc...) + +* Daemon names are not unified between distributions + (apache vs httpd, cron vs crond, various syslog variations) + +To solve these problems LTP has 'testcases/lib/daemonlib.sh' library that +provides functions to start/stop/query daemons as well as variables that store +correct daemon name. + +.Supported operations +|============================================================================== +| start_daemon() | Starts daemon, name is passed as first parameter. +| stop_daemon() | Stops daemon, name is passed as first parameter. +| restart_daemon() | Restarts daemon, name is passed as first parameter. +| status_daemon() | Returns daemon status, TODO: what is return value? +|============================================================================== + +.Variables with detected names +|============================================================================== +| CROND_DAEMON | Cron daemon name (cron, crond). +| SYSLOG_DAEMON | Syslog daemon name (syslog, syslog-ng, rsyslog). +|============================================================================== + +.Cron daemon restart example +[source,sh] +------------------------------------------------------------------------------- +#!/bin/sh +# +# Cron daemon restart example +# +TCID=cron01 +TST_COUNT=1 +. test.sh +. daemonlib.sh + +... + +restart_daemon $CROND_DAEMON + +... + +tst_exit +------------------------------------------------------------------------------- + 3. Common problems ------------------ |