public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] cron02: fix a bug of /etc/init.d/crond is nonexistent
@ 2012-03-29  9:58 Peng Haitao
  2012-03-29 10:06 ` Garrett Cooper
  0 siblings, 1 reply; 5+ messages in thread
From: Peng Haitao @ 2012-03-29  9:58 UTC (permalink / raw)
  To: caspar, gaowanlong; +Cc: ltp-list

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

Signed-off-by: Peng Haitao <penght@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

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

end of thread, other threads:[~2012-03-30  1:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-29  9:58 [LTP] [PATCH] cron02: fix a bug of /etc/init.d/crond is nonexistent Peng Haitao
2012-03-29 10:06 ` Garrett Cooper
2012-03-30  1:05   ` [LTP] [PATCH v2] " Peng Haitao
2012-03-30  1:07     ` Garrett Cooper
2012-03-30  1:13       ` Wanlong Gao

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