* [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
* Re: [LTP] [PATCH] cron02: fix a bug of /etc/init.d/crond is nonexistent
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
0 siblings, 1 reply; 5+ messages in thread
From: Garrett Cooper @ 2012-03-29 10:06 UTC (permalink / raw)
To: Peng Haitao; +Cc: ltp-list
On Thu, Mar 29, 2012 at 2:58 AM, Peng Haitao <penght@cn.fujitsu.com> wrote:
> /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
> +
HAVE_SYSTEMCTL=true/false is easier to deal with. That way you can do...
if $HAVE_SYSTEMCTL
then
# do something...
:
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
bashism (==).
> + 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
------------------------------------------------------------------------------
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 [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2] cron02: fix a bug of /etc/init.d/crond is nonexistent
2012-03-29 10:06 ` Garrett Cooper
@ 2012-03-30 1:05 ` Peng Haitao
2012-03-30 1:07 ` Garrett Cooper
0 siblings, 1 reply; 5+ messages in thread
From: Peng Haitao @ 2012-03-30 1:05 UTC (permalink / raw)
To: yanegomi; +Cc: ltp-list
/etc/init.d/crond is nonexistent in fedora16, so should use 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..d348936 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=true
+ else
+ HAVE_SYSTEMCTL=false
+ 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; 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
* Re: [LTP] [PATCH v2] cron02: fix a bug of /etc/init.d/crond is nonexistent
2012-03-30 1:05 ` [LTP] [PATCH v2] " Peng Haitao
@ 2012-03-30 1:07 ` Garrett Cooper
2012-03-30 1:13 ` Wanlong Gao
0 siblings, 1 reply; 5+ messages in thread
From: Garrett Cooper @ 2012-03-30 1:07 UTC (permalink / raw)
To: Peng Haitao; +Cc: ltp-list
On Thu, Mar 29, 2012 at 6:05 PM, Peng Haitao <penght@cn.fujitsu.com> wrote:
> /etc/init.d/crond is nonexistent in fedora16, so should use 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..d348936 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=true
> + else
> + HAVE_SYSTEMCTL=false
> + 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; 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
Reviewed-by: Garrett Cooper <yanegomi@gmail.com>
------------------------------------------------------------------------------
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 [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2] cron02: fix a bug of /etc/init.d/crond is nonexistent
2012-03-30 1:07 ` Garrett Cooper
@ 2012-03-30 1:13 ` Wanlong Gao
0 siblings, 0 replies; 5+ messages in thread
From: Wanlong Gao @ 2012-03-30 1:13 UTC (permalink / raw)
To: Garrett Cooper; +Cc: ltp-list
On 03/30/2012 09:07 AM, Garrett Cooper wrote:
> On Thu, Mar 29, 2012 at 6:05 PM, Peng Haitao <penght@cn.fujitsu.com> wrote:
>> /etc/init.d/crond is nonexistent in fedora16, so should use 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..d348936 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=true
>> + else
>> + HAVE_SYSTEMCTL=false
>> + 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; 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
>
> Reviewed-by: Garrett Cooper <yanegomi@gmail.com>
pushed, thanks Peng, Garrett,
Wanlong Gao
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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 [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