Openembedded Devel Discussions
 help / color / mirror / Atom feed
From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: Re: [meta-oe][PATCH] rsyslog: add status command and minor fixes for initscript
Date: Sun, 20 Apr 2014 16:14:13 +0200	[thread overview]
Message-ID: <20140420141413.GO2486@jama> (raw)
In-Reply-To: <1397640676-27955-1-git-send-email-jackie.huang@windriver.com>

[-- Attachment #1: Type: text/plain, Size: 3288 bytes --]

On Wed, Apr 16, 2014 at 05:31:16PM +0800, jackie.huang@windriver.com wrote:
> From: Jackie Huang <jackie.huang@windriver.com>
> 
> - add status command
> - remove the unsupported option:
>   rsyslogd: error: option -c is no longer supported - ignored
> - add --oknodo for do_start

Merged, thanks!

> 
> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
> ---
>  .../recipes-extended/rsyslog/rsyslog/initscript    |   35 ++++++++++++++++++--
>  1 file changed, 32 insertions(+), 3 deletions(-)
> 
> diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/initscript b/meta-oe/recipes-extended/rsyslog/rsyslog/initscript
> index 8dee684..4121434 100644
> --- a/meta-oe/recipes-extended/rsyslog/rsyslog/initscript
> +++ b/meta-oe/recipes-extended/rsyslog/rsyslog/initscript
> @@ -9,7 +9,8 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
>  NAME=rsyslog
>  RSYSLOGD=rsyslogd
>  RSYSLOGD_BIN=/usr/sbin/rsyslogd
> -RSYSLOGD_OPTIONS="-c5"
> +# with rsyslog 7, -c is no longer supported
> +RSYSLOGD_OPTIONS=""
>  RSYSLOGD_PIDFILE=/var/run/rsyslogd.pid
>  SCRIPTNAME=/etc/init.d/$NAME
>  # Exit if the package is not installed
> @@ -27,7 +28,10 @@ do_start()
>          # Return
>          #   0 if daemon has been started
>          #   1 if daemon could not be started
> -        start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS || return 1
> +        #   if daemon had already been started, start-stop-daemon will return 1
> +        #   so add -o/--oknodo(if nothing is done, exit 0)
> +        start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON \
> +                             --oknodo -- $DAEMON_ARGS || return 1
>  }
>  #
>  # Function that stops the daemon/service
> @@ -56,6 +60,20 @@ do_reload() {
>          start-stop-daemon -K --signal HUP --quiet --pidfile $PIDFILE --name $NAME
>          return 0
>  }
> +
> +do_status() {
> +        NAME=$1
> +        PIDFILE=$2
> +        # -t: test only but not stop
> +        start-stop-daemon -K -t --quiet --pidfile $PIDFILE --name $NAME
> +        # exit with status 0 if process is found
> +        if [ "$?" = "0" ]; then
> +                return 0
> +        else
> +                return 1
> +        fi
> +}
> +
>  case "$1" in
>    start)
>          echo -n "starting $RSYSLOGD ... "
> @@ -82,8 +100,19 @@ case "$1" in
>          $0 stop
>          $0 start
>          ;;
> +  status)
> +        echo -n "status $RSYSLOGD ... "
> +        do_status "$RSYSLOGD" "$RSYSLOGD_PIDFILE"
> +        if [ "$?" = "0" ]; then
> +                echo "running"
> +                exit 0        
> +        else
> +                echo "stopped"
> +                exit 1        
> +        fi
> +        ;;
>    *)
> -        echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
> +        echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
>          exit 3
>          ;;
>  esac
> -- 
> 1.7.9.5
> 
> -- 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

      parent reply	other threads:[~2014-04-20 14:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-16  9:31 [meta-oe][PATCH] rsyslog: add status command and minor fixes for initscript jackie.huang
2014-04-16  9:46 ` Jack Mitchell
2014-04-17  1:51   ` Huang, Jie (Jackie)
2014-04-20 14:14 ` Martin Jansa [this message]

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=20140420141413.GO2486@jama \
    --to=martin.jansa@gmail.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox