/etc/init.d/crond is nonexistent in fedora16, so should be replaced with
systemctl.

Signed-off-by: Peng Haitao <pen...@cn.fujitsu.com>
---
 testcases/commands/cron/cron02 |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/testcases/commands/cron/cron02 b/testcases/commands/cron/cron02
index 0c05c95..213fe02 100755
--- a/testcases/commands/cron/cron02
+++ b/testcases/commands/cron/cron02
@@ -52,12 +52,26 @@ do_setup(){
         }
         fi
 
+       # running under systemd?
+       if command -v systemctl >/dev/null 2>&1; then
+               HAVE_SYSTEMCTL=1
+       else
+               HAVE_SYSTEMCTL=0
+       fi
+
        # restart cron daemon
        # Red Hat uses crond, SuSE/Other uses cron.
        if [ -x /etc/init.d/crond ]; then
                /etc/init.d/crond restart
        elif [ -x /etc/init.d/cron ]; then
                /etc/init.d/cron restart
+       elif [ $HAVE_SYSTEMCTL == 1 ]; then
+               for crond in "crond" "cron"; do
+                       if systemctl is-enabled $crond.service >/dev/null 2>&1; 
then
+                               systemctl restart $crond.service
+                               break
+                       fi
+               done
        else
                echo "Could not determine cron init.d script."
                exit 1
-- 
1.7.10.rc1


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to