public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP]  [PATCH] xinetd_tests.sh: support systemd restart
@ 2014-03-26  7:29 Simon Xu
  2014-03-26 12:03 ` chrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Xu @ 2014-03-26  7:29 UTC (permalink / raw)
  To: ltp-list

Support xinetd service restart by systemd, which is used in recent
Linux releases, e.g. RHEL7.

Signed-off-by: Simon Xu <xu.simon@oracle.com>
---
 testcases/network/xinetd/xinetd_tests.sh | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
index dac23a8..14b5c21 100755
--- a/testcases/network/xinetd/xinetd_tests.sh
+++ b/testcases/network/xinetd/xinetd_tests.sh
@@ -59,6 +59,12 @@ chk_ifexists()
 #               - non-zero on failure.
 init()
 {
+    if [ -f "/usr/lib/systemd/system/xinetd.service" ]; then
+        RESTARTCMD="systemctl restart xinetd.service"
+    else
+        RESTARTCMD="/etc/init.d/xinetd restart"
+    fi
+
     # Initialize global variables.
     export TST_TOTAL=2
     export TCID="xinetd"
@@ -226,7 +232,7 @@ cleanup()
         sleep 1s
 
         # restoring original services
-        /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.err 2>&1
+        $RESTARTCMD > $LTPTMP/tst_xinetd.err 2>&1
         RC=$?
         if [ $RC -ne 0 ]
         then
@@ -285,7 +291,7 @@ test01()
     sleep 1s
 
     # restart xinetd to re-start the services
-    /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1
+    $RESTARTCMD > $LTPTMP/tst_xinetd.out 2>&1
     RC=$?
     if [ $RC -ne 0 ]
     then
@@ -352,7 +358,7 @@ test01()
     sleep 1s
 
     # restart services.
-    /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1
+    $RESTARTCMD > $LTPTMP/tst_xinetd.out 2>&1
     RC=$?
     if [ $RC -ne 0 ]
     then
-- 
1.8.5.4


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-03-27 13:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26  7:29 [LTP] [PATCH] xinetd_tests.sh: support systemd restart Simon Xu
2014-03-26 12:03 ` chrubis
2014-03-26 13:19   ` chrubis
2014-03-26 16:27     ` [LTP] [PATCH] xinetd_test.sh: restart xinetd by restart_daemon() Simon Xu
2014-03-26 17:00       ` chrubis
2014-03-27  2:26         ` [LTP] [PATCH V2] " Simon Xu
2014-03-27 13:54           ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox