Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From f774ac25f436a782ccccc4dbe68378a684596799 Mon Sep 17 00:00:00 2001 |
| 2 | From: Lu Chong <Chong.Lu@windriver.com> |
| 3 | Date: Thu, 7 Nov 2013 14:36:28 +0800 |
| 4 | Subject: [PATCH] avahi: fix avahi status command error prompt |
| 5 | |
| 6 | service --status-all command will display wrong status for avahi-daemon. |
| 7 | This commit fix this error prompt and make service display right status |
| 8 | for avahi-daemon. |
| 9 | |
| 10 | Upstream-Status: Pending |
| 11 | |
| 12 | Signed-off-by: Lu Chong <Chong.Lu@windriver.com> |
| 13 | --- |
| 14 | initscript/debian/avahi-daemon.in | 14 +++++++++++--- |
| 15 | 1 file changed, 11 insertions(+), 3 deletions(-) |
| 16 | |
| 17 | diff --git a/initscript/debian/avahi-daemon.in b/initscript/debian/avahi-daemon.in |
| 18 | index 4793b46..49ec358 100755 |
| 19 | --- a/initscript/debian/avahi-daemon.in |
| 20 | +++ b/initscript/debian/avahi-daemon.in |
| 21 | @@ -153,7 +153,15 @@ d_reload() { |
| 22 | # Function that check the status of the daemon/service. |
| 23 | # |
| 24 | d_status() { |
| 25 | - $DAEMON -c && echo "$DESC is running" || echo "$DESC is not running" |
| 26 | + $DAEMON -c |
| 27 | + status=$? |
| 28 | + if [ $status = 0 ]; then |
| 29 | + echo "$DESC is running" |
| 30 | + return 0 |
| 31 | + else |
| 32 | + echo "$DESC is not running" |
| 33 | + return 3 |
| 34 | + fi |
| 35 | } |
| 36 | |
| 37 | case "$1" in |
| 38 | @@ -182,9 +190,9 @@ case "$1" in |
| 39 | d_status |
| 40 | ;; |
| 41 | *) |
| 42 | - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2 |
| 43 | + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload|status}" >&2 |
| 44 | exit 1 |
| 45 | ;; |
| 46 | esac |
| 47 | |
| 48 | -exit 0 |
| 49 | +exit $? |
| 50 | -- |
| 51 | 1.7.9.5 |
| 52 | |