[LTP] [PATCH v2 2/2] at_deny01: Use lib to restart atd service

Peng Haitao
2012-12-07T03:54:27Z

Use restart_daemon() to restart atd service.

Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
testcases/commands/at/at_deny01 | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/testcases/commands/at/at_deny01 b/testcases/commands/at/at_deny01
index fe3dce0..73dbe0d 100755
--- a/testcases/commands/at/at_deny01
+++ b/testcases/commands/at/at_deny01
@@ -38,6 +38,10 @@ test_user1_home="/home/${test_user1}"
test_user2_home="/home/${test_user2}"
tmpfile="$TMP/at_deny_test"

+if [ "$(id -ru)" = 0 ]; then
+ . cmdlib.sh
+fi
+
#-----------------------------------------------------------------------
# FUNCTION: do_setup
#-----------------------------------------------------------------------
@@ -86,19 +90,7 @@ do_setup()
exit 1
fi

- # running under systemd?
- if command -v systemctl >/dev/null 2>&1; then
- HAVE_SYSTEMCTL=true
- else
- HAVE_SYSTEMCTL=false
- fi
-
- # Restart atd daemon.
- if $HAVE_SYSTEMCTL; then
- systemctl restart atd.service
- else
- /etc/init.d/atd restart
- fi
+ restart_daemon atd
}

#-----------------------------------------------------------------------
--
1.8.0.1