Patchwork [6/6] openssh: add init.d/sshd status command for LSB compliance

login
register
mail settings
Submitter jackie huang
Date Aug. 21, 2013, 6:15 a.m.
Message ID <0b8b0b9d30aa7677a5c23e4d03d4ce6e21678ad7.1377064624.git.jackie.huang@windriver.com>
Download mbox | patch
Permalink /patch/56113/
State New
Headers show

Comments

jackie huang - Aug. 21, 2013, 6:15 a.m.
From: Jackie Huang <jackie.huang@windriver.com>

Signed-off-by: Li Wang <li.wang@windriver.com>
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
 .../openssh/openssh-6.2p2/init                     |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
Saul Wold - Aug. 21, 2013, 5:34 p.m.
On 08/20/2013 11:15 PM, jackie.huang@windriver.com wrote:
> From: Jackie Huang <jackie.huang@windriver.com>
>
> Signed-off-by: Li Wang <li.wang@windriver.com>
> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
> ---
>   .../openssh/openssh-6.2p2/init                     |   14 +++++++++++++-
>   1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/init b/meta/recipes-connectivity/openssh/openssh-6.2p2/init
> index 12fb79b..72c5822 100644
> --- a/meta/recipes-connectivity/openssh/openssh-6.2p2/init
> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/init
> @@ -1,6 +1,9 @@
>   #! /bin/sh
>   set -e
>
> +# source function library
> +. /etc/init.d/functions
> +
>   # /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon
>
>   test -x /usr/sbin/sshd || exit 0
> @@ -54,6 +57,11 @@ check_keys() {
>   	fi
>   }
>
> +rh_status() {
> +	status /usr/sbin/sshd
> +	return $?
> +}
> +
>   export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
>
>   case "$1" in
> @@ -92,8 +100,12 @@ case "$1" in
>   	echo "."
>   	;;
>
> +  status)
> +	rh_status

Why rh_status here and in the "at" script?  Can't you just do the status 
/usr/bin/sshd directly here?

> +  ;;
> +
>     *)
> -	echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
> +	echo "Usage: /etc/init.d/ssh {start|stop|status|reload|force-reload|restart}"
>   	exit 1
>   esac
>
>
jackie huang - Aug. 22, 2013, 5:53 a.m.
On 8/22/2013 1:34 AM, Saul Wold wrote:
> On 08/20/2013 11:15 PM, jackie.huang@windriver.com wrote:
>> From: Jackie Huang <jackie.huang@windriver.com>
>>
>> Signed-off-by: Li Wang <li.wang@windriver.com>
>> Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
>> ---
>>   .../openssh/openssh-6.2p2/init                     |   14
>> +++++++++++++-
>>   1 files changed, 13 insertions(+), 1 deletions(-)
>>
>> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/init
>> b/meta/recipes-connectivity/openssh/openssh-6.2p2/init
>> index 12fb79b..72c5822 100644
>> --- a/meta/recipes-connectivity/openssh/openssh-6.2p2/init
>> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/init
>> @@ -1,6 +1,9 @@
>>   #! /bin/sh
>>   set -e
>>
>> +# source function library
>> +. /etc/init.d/functions
>> +
>>   # /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon
>>
>>   test -x /usr/sbin/sshd || exit 0
>> @@ -54,6 +57,11 @@ check_keys() {
>>       fi
>>   }
>>
>> +rh_status() {
>> +    status /usr/sbin/sshd
>> +    return $?
>> +}
>> +
>>   export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
>>
>>   case "$1" in
>> @@ -92,8 +100,12 @@ case "$1" in
>>       echo "."
>>       ;;
>>
>> +  status)
>> +    rh_status
>
> Why rh_status here and in the "at" script?  Can't you just do the status
> /usr/bin/sshd directly here?

We may found this from Red Hat/Fedora, sure we can do it directly here, 
I will change it if you think it would be better.

Thanks,
Jackie

>
>> +  ;;
>> +
>>     *)
>> -    echo "Usage: /etc/init.d/ssh
>> {start|stop|reload|force-reload|restart}"
>> +    echo "Usage: /etc/init.d/ssh
>> {start|stop|status|reload|force-reload|restart}"
>>       exit 1
>>   esac
>>
>>
>

Patch

diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/init b/meta/recipes-connectivity/openssh/openssh-6.2p2/init
index 12fb79b..72c5822 100644
--- a/meta/recipes-connectivity/openssh/openssh-6.2p2/init
+++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/init
@@ -1,6 +1,9 @@ 
 #! /bin/sh
 set -e
 
+# source function library
+. /etc/init.d/functions
+
 # /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon
 
 test -x /usr/sbin/sshd || exit 0
@@ -54,6 +57,11 @@  check_keys() {
 	fi
 }
 
+rh_status() {
+	status /usr/sbin/sshd
+	return $?
+}
+
 export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
 
 case "$1" in
@@ -92,8 +100,12 @@  case "$1" in
 	echo "."
 	;;
 
+  status)
+	rh_status
+  ;;
+
   *)
-	echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
+	echo "Usage: /etc/init.d/ssh {start|stop|status|reload|force-reload|restart}"
 	exit 1
 esac