Support xinetd service restart by systemd, which is used in recent Linux releases, e.g. RHEL7.
Signed-off-by: Simon Xu <[email protected]> --- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
