rsyslog: add status command and minor fixes for initscript
PATCH 1/1 rsyslog: add status command and minor fixes for initscript
From: Jackie Huang <[email protected]>
- add status command
- remove the unsupported option:
rsyslogd: error: option -c is no longer supported - ignored
- add --oknodo for do_start
--- .../recipes-extended/rsyslog/rsyslog/initscript | 35 ++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-)
meta-oe/recipes-extended/rsyslog/rsyslog/initscript +32 -3
@@ -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
Signature · 1 line
1.7.9.5
Quoted 71 lines · On 16/04/14 10:31, [email protected] wrote:
From: Jackie Huang <[email protected]>
- add status command
- remove the unsupported option:
rsyslogd: error: option -c is no longer supported - ignored
- add --oknodo fordo_startSigned-off-by Jackie Huang <[email protected]>--- .../recipes-extended/rsyslog/rsyslog/initscript | 35 ++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-)meta-oe/recipes-extended/rsyslog/rsyslog/initscript +27
-2@@ -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
meta-oe/recipes-extended/rsyslog/rsyslog/initscript case "$1" in · line 118
Quoted 10 lines
meta-oe/recipes-extended/rsyslog/rsyslog/initscript +5
-1+ 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
Hi Jackie,
I have a patch pending that fixes the rsyslog unsupported option. I don't know if you want to take that and re-spin a v2 otherwise the patch will probably fail to apply.
Cheers,
Signature · 5 lines
Jack Mitchell ([email protected]) Embedded Systems Engineer Cambridgeshire, UK http://www.embed.me.uk --
Quoted 96 lines
-----Original Message-----
From: [email protected] [mailto:openembedded-devel- [email protected]] On Behalf Of Jack Mitchell
Sent: Wednesday, April 16, 2014 5:46 PM
To: [email protected]
Subject: Re: [oe] [meta-oe][PATCH] rsyslog: add status command and minor fixes for initscriptQuoted 20 lines · On 16/04/14 10:31, [email protected] wrote:
From: Jackie Huang <[email protected]>
- add status command
- remove the unsupported option:
rsyslogd: error: option -c is no longer supported - ignored
- add --oknodo fordo_startSigned-off-by Jackie Huang <[email protected]>--- .../recipes-extended/rsyslog/rsyslog/initscript | 35 ++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-)meta-oe/recipes-extended/rsyslog/rsyslog/initscript +0
-0@@ -9,7 +9,8 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin NAME=rsyslog RSYSLOGD=rsyslogdmeta-oe/recipes-extended/rsyslog/rsyslog/initscript PATH=/sbin:/usr/sbin:/bin:/usr/bin
Quoted 10 lines
meta-oe/recipes-extended/rsyslog/rsyslog/initscript +1
-2RSYSLOGD_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 || return1
Quoted 41 lines
meta-oe/recipes-extended/rsyslog/rsyslog/initscript +4
-0+ # 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}
meta-oe/recipes-extended/rsyslog/rsyslog/initscript +22
-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"meta-oe/recipes-extended/rsyslog/rsyslog/initscript case "$1" in · line 118
Quoted 10 lines
meta-oe/recipes-extended/rsyslog/rsyslog/initscript +5
-1+ 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 ;; esacHi Jackie,
Quoted 2 lines
I have a patch pending that fixes the rsyslog unsupported option. I don't know if you want to take that and re-spin a v2 otherwise the patch will probably fail to apply.
Sorry I didn't notice that, I will take that and re-spin a v2.
Thanks,
Jackie
Quoted 14 lines
Cheers,
--
Jack Mitchell ([email protected])
Embedded Systems Engineer
Cambridgeshire, UK
http://www.embed.me.uk
--
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Martin Jansa
AppliedQuoted 6 lines · On Wed, Apr 16, 2014 at 05:31:16PM +0800, [email protected] wrote:
From: Jackie Huang <[email protected]>
- add status command
- remove the unsupported option:
rsyslogd: error: option -c is no longer supported - ignored
- add --oknodo fordo_start
Merged, thanks!
Quoted 82 lines
Signed-off-by Jackie Huang <[email protected]>--- .../recipes-extended/rsyslog/rsyslog/initscript | 35 ++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-)meta-oe/recipes-extended/rsyslog/rsyslog/initscript +32
-3@@ -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 ;; esacSignature · 7 lines
1.7.9.5 -- _______________________________________________ Openembedded-devel mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]