diff mbox

[4/4] Package netsnmp: Added OK/FAIL output

Message ID 1456435484-4723-4-git-send-email-universeII@gmx.de
State Accepted
Headers show

Commit Message

universe II Feb. 25, 2016, 9:24 p.m. UTC
Reworked output of start(), stop() and reload() functions.
Return values of start-stop-daemon are now checked and
a OK or FAIL message is printed out.

Signed-off-by: Andreas Ehmanns <universeII@gmx.de>
---
 package/netsnmp/S59snmpd | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

Comments

Yann E. MORIN July 1, 2016, 12:36 p.m. UTC | #1
Andreas, All,

On 2016-02-25 22:24 +0100, Andreas Ehmanns spake thusly:
> Reworked output of start(), stop() and reload() functions.
> Return values of start-stop-daemon are now checked and
> a OK or FAIL message is printed out.
> 
> Signed-off-by: Andreas Ehmanns <universeII@gmx.de>
> ---
>  package/netsnmp/S59snmpd | 35 +++++++++++++++++++++--------------
>  1 file changed, 21 insertions(+), 14 deletions(-)
> 
> diff --git a/package/netsnmp/S59snmpd b/package/netsnmp/S59snmpd
> index 2d076e0..94773db 100755
> --- a/package/netsnmp/S59snmpd
> +++ b/package/netsnmp/S59snmpd
[--SNIP--]
> @@ -92,6 +98,7 @@ case "$1" in
>      reload|force-reload)
>          reload
>          ;;
> +

Spurious empty line.

Otherwise:

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

>      *)
>          echo "Usage: $0 {start|stop|restart|reload|force-reload}"
>          exit 1
> -- 
> 2.1.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni July 1, 2016, 1:04 p.m. UTC | #2
Hello,

On Fri, 1 Jul 2016 14:36:44 +0200, Yann E. MORIN wrote:

> > @@ -92,6 +98,7 @@ case "$1" in
> >      reload|force-reload)
> >          reload
> >          ;;
> > +  
> 
> Spurious empty line.

It's indeed not strictly related, but in all other cases of this
switch, there is an empty line separating cases. So I think it's good
to also have this one for consistency. It could have been in a separate
commit, but oh well, that was good enough.

Thanks for the review!

Thomas
universe II July 6, 2016, 4:47 p.m. UTC | #3
Dear Thomas, Yann, all,
thanks for revising the patch series and for incorporating the changes 
into buildroot.

Regards,
Andreas


Am 01.07.2016 um 15:04 schrieb Thomas Petazzoni:
> Hello,
>
> On Fri, 1 Jul 2016 14:36:44 +0200, Yann E. MORIN wrote:
>
>>> @@ -92,6 +98,7 @@ case "$1" in
>>>       reload|force-reload)
>>>           reload
>>>           ;;
>>> +
>> Spurious empty line.
> It's indeed not strictly related, but in all other cases of this
> switch, there is an empty line separating cases. So I think it's good
> to also have this one for consistency. It could have been in a separate
> commit, but oh well, that was good enough.
>
> Thanks for the review!
>
> Thomas
diff mbox

Patch

diff --git a/package/netsnmp/S59snmpd b/package/netsnmp/S59snmpd
index 2d076e0..94773db 100755
--- a/package/netsnmp/S59snmpd
+++ b/package/netsnmp/S59snmpd
@@ -38,39 +38,45 @@  if [ "$SNMPDCOMPAT" = "yes" ]; then
 fi
 
 start() {
-    printf "Starting network management services:"
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+        printf "Starting SNMP daemon: "
         start-stop-daemon -q -S -x /usr/sbin/snmpd -- $SNMPDOPTS
-        printf " snmpd"
+        [ $? = 0 ] && echo "OK" || echo "FAIL"
     fi
+
     if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
+        printf "Starting SNMP trap daemon: "
         start-stop-daemon -q -S -x /usr/sbin/snmptrapd -- $TRAPDOPTS
-        printf " snmptrapd"
+        [ $? = 0 ] && echo "OK" || echo "FAIL"
     fi
-    echo "."
 }
 
 stop() {
-    printf "Stopping network management services:"
-    start-stop-daemon -q -K $ssd_oknodo -x /usr/sbin/snmpd
-    printf " snmpd"
-    start-stop-daemon -q -K $ssd_oknodo -x /usr/sbin/snmptrapd
-    printf " snmptrapd"
-    echo "."
+    if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+        printf "Stopping SNMP daemon: "
+        start-stop-daemon -q -K $ssd_oknodo -x /usr/sbin/snmpd
+        [ $? = 0 ] && echo "OK" || echo "FAIL"
+    fi
+
+    if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
+        printf "Stopping SNMP trap daemon: "
+        start-stop-daemon -q -K $ssd_oknodo -x /usr/sbin/snmptrapd
+        [ $? = 0 ] && echo "OK" || echo "FAIL"
+    fi
 }
 
 reload() {
-    printf "Reloading network management services:"
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+        printf "Reloading SNMP daemon: "
         start-stop-daemon -q -K -s 1 -p /var/run/snmpd.pid -x /usr/sbin/snmpd
-        printf " snmpd"
+       [ $? = 0 ] && echo "OK" || echo "FAIL" 
     fi
 
     if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
+        printf "Reloading SNMP trap daemon: "
         start-stop-daemon -q -K -s 1 -p /var/run/snmptrapd.pid -x /usr/sbin/snmptrapd
-        printf " snmptrapd"
+        [ $? = 0 ] && echo "OK" || echo "FAIL"
     fi
-    echo "."
 }
 
 case "$1" in
@@ -92,6 +98,7 @@  case "$1" in
     reload|force-reload)
         reload
         ;;
+
     *)
         echo "Usage: $0 {start|stop|restart|reload|force-reload}"
         exit 1