All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: Peng Haitao <penght@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v2] syslog-lib.sh: Use lib to restart syslog service
Date: Wed, 10 Jul 2013 14:48:04 -0400 (EDT)	[thread overview]
Message-ID: <267085751.2020967.1373482084934.JavaMail.root@redhat.com> (raw)
In-Reply-To: <1373424973-32151-1-git-send-email-penght@cn.fujitsu.com>



----- Original Message -----
> From: "Peng Haitao" <penght@cn.fujitsu.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Wednesday, 10 July, 2013 4:56:13 AM
> Subject: [LTP] [PATCH v2] syslog-lib.sh: Use lib to restart syslog service
> 
> Use restart_daemon() to restart syslog service.
> 
> Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>

Hi,

looks good to me. I also ran all syslog testcases with this patch
on systemd/rsyslog based distro (RHEL7alpha) - all PASSed.

Regards,
Jan

> ---
>  testcases/kernel/syscalls/syslog/syslog-lib.sh | 65
>  ++++++--------------------
>  1 file changed, 15 insertions(+), 50 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/syslog/syslog-lib.sh
> b/testcases/kernel/syscalls/syslog/syslog-lib.sh
> index c912d61..0885805 100755
> --- a/testcases/kernel/syscalls/syslog/syslog-lib.sh
> +++ b/testcases/kernel/syscalls/syslog/syslog-lib.sh
> @@ -29,16 +29,6 @@ CONFIG_FILE=""
>  # rsyslogd .conf specific args.
>  RSYSLOG_CONFIG=
>  
> -# Command to restart syslog daemon.
> -SYSLOG_RESTART_COMMAND=
> -
> -# running under systemd?
> -if command -v systemctl >/dev/null 2>&1; then
> -	HAVE_SYSTEMCTL=1
> -else
> -	HAVE_SYSTEMCTL=0
> -fi
> -
>  # number of seconds to wait for another syslog test to complete
>  WAIT_COUNT=60
>  
> @@ -75,43 +65,15 @@ setup()
>  		tst_resm TBROK "Testing is terminating due to a signal"
>  		cleanup 1' $TRAP_SIGS || exit 1
>  
> -	# Check to see if syslogd or syslog-ng exists
> -	if [ -e /sbin/syslogd ]; then
> +	if [ "$SYSLOG_DAEMON" == "syslog" ]; then
>  		CONFIG_FILE="/etc/syslog.conf"
> -		SYSLOG_INIT_SCRIPT="/etc/init.d/sysklogd"
> -	elif command -v syslog-ng >/dev/null 2>&1; then
> +	elif [ "$SYSLOG_DAEMON" == "syslog-ng" ]; then
>  		CONFIG_FILE="/etc/syslog-ng/syslog-ng.conf"
> -		SYSLOG_INIT_SCRIPT="/etc/init.d/syslog-ng"
> -	elif command -v rsyslogd >/dev/null 2>&1; then
> +	elif [ "$SYSLOG_DAEMON" == "rsyslog" ]; then
>  		CONFIG_FILE="/etc/rsyslog.conf"
> -		SYSLOG_INIT_SCRIPT="/etc/init.d/rsyslog"
>  		RSYSLOG_CONFIG='$ModLoad imuxsock.so'
>  	else
> -		tst_resm TCONF "couldn't find syslogd, syslog-ng, or rsyslogd"
> -		cleanup	0
> -	fi
> -
> -	SVCNAME=$(basename $SYSLOG_INIT_SCRIPT)
> -	if [ $HAVE_SYSTEMCTL == 1 ]; then
> -		for svc in "$SVCNAME" "syslog"; do
> -			if systemctl is-enabled $svc.service >/dev/null 2>&1; then
> -				SYSLOG_RESTART_COMMAND="systemctl restart $svc.service"
> -				break
> -			fi
> -		done
> -	else
> -		# Fallback to /etc/init.d/syslog if $SYSLOG_INIT_SCRIPT
> -		# doesn't exist.
> -		for SYSLOG_INIT_SCRIPT in "$SYSLOG_INIT_SCRIPT" "/etc/init.d/syslog"; do
> -			if [ -x "$SYSLOG_INIT_SCRIPT" ]; then
> -				SYSLOG_RESTART_COMMAND="$SYSLOG_INIT_SCRIPT restart"
> -				break
> -			fi
> -		done
> -	fi
> -
> -	if [ -z "$SYSLOG_RESTART_COMMAND" ]; then
> -		tst_resm TBROK "Don't know how to restart $SVCNAME"
> +		tst_resm TBROK "Couldn't find syslogd, syslog-ng or rsyslogd"
>  		cleanup 1
>  	fi
>  
> @@ -152,15 +114,18 @@ restart_syslog_daemon()
>  		cleanup_command=$1
>  	fi
>  
> -	tst_resm TINFO "restarting syslog daemon via $SYSLOG_RESTART_COMMAND"
> +	tst_resm TINFO "restarting syslog daemon"
>  
> -	if $SYSLOG_RESTART_COMMAND >/dev/null 2>&1; then
> -		# XXX: this really shouldn't exist; if *syslogd isn't ready
> -		# once the restart directive has been issued, then it needs to
> -		# be fixed.
> -		sleep 2
> -	else
> -		$cleanup_command
> +	if [ -n "$SYSLOG_DAEMON" ]; then
> +		restart_daemon $SYSLOG_DAEMON
> +		if [ $? -eq 0 ]; then
> +			# XXX: this really shouldn't exist; if *syslogd isn't
> +			# ready once the restart directive has been issued,
> +			# then it needs to be fixed.
> +			sleep 2
> +		else
> +			$cleanup_command
> +		fi
>  	fi
>  }
>  
> --
> 1.8.3.1
> 
> 
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2013-07-10 18:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  2:56 [LTP] [PATCH v2] syslog-lib.sh: Use lib to restart syslog service Peng Haitao
2013-07-10 18:48 ` Jan Stancek [this message]
2013-07-11  1:39   ` Wanlong Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=267085751.2020967.1373482084934.JavaMail.root@redhat.com \
    --to=jstancek@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=penght@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.