When vsftpd is disabled, runnetnstest.sh should start vsftpd first.

Signed-off-by: Peng Haitao <[email protected]>
---
 testcases/kernel/containers/netns/runnetnstest.sh | 29 +++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/testcases/kernel/containers/netns/runnetnstest.sh 
b/testcases/kernel/containers/netns/runnetnstest.sh
index d2a7fec..92a1cd6 100755
--- a/testcases/kernel/containers/netns/runnetnstest.sh
+++ b/testcases/kernel/containers/netns/runnetnstest.sh
@@ -106,6 +106,26 @@ echo
 #fi
 #echo
 
+flag=0
+# running under systemd?
+if command -v systemctl >/dev/null 2>&1; then
+       HAVE_SYSTEMCTL=1
+else
+       HAVE_SYSTEMCTL=0
+fi
+
+if [ $HAVE_SYSTEMCTL -eq 1 ]; then
+       systemctl status vsftpd.service > /dev/null 2>&1 || flag=$?
+       if [ $flag -ne 0 ]; then
+               systemctl start vsftpd.service > /dev/null 2>&1
+       fi
+else
+       service vsftpd status > /dev/null 2>&1 || flag=$?
+       if [ $flag -ne 0 ]; then
+               service vsftpd start > /dev/null 2>&1
+       fi
+fi
+
 par_chld_ftp
 rc=$?
 if [ $rc -ne 0 ]; then
@@ -115,5 +135,14 @@ if [ $rc -ne 0 ]; then
 else
    echo "par_chld_ftp: PASS"
 fi
+
+if [ $flag -ne 0 ]; then
+       if [ $HAVE_SYSTEMCTL -eq 1 ]; then
+               systemctl stop vsftpd.service > /dev/null 2>&1
+       else
+               service vsftpd stop > /dev/null 2>&1
+       fi
+fi
+
 echo
 exit $exit_code
-- 
1.8.0


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to