On Thu, Mar 29, 2012 at 2:58 AM, Peng Haitao <[email protected]> wrote:
> /etc/init.d/crond is nonexistent in fedora16, so should be replaced with
> systemctl.
>
> Signed-off-by: Peng Haitao <[email protected]>
> ---
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list