+++ This bug was initially created as a clone of Bug #430877 +++ Escalated to Bugzilla from IssueTracker -- Additional comment from tao on 2008-01-30 07:05 EST -- 1. Provide clear and concise problem description as it is understood at the time of escalation The command "service sshd status" does not tell whether the sshd service is running. Instead it tells whether there are any sshd processes in the process table. It happens on both RHEL 5.1 and RHEL 4.6 (and, presumably, everything in between). For example: # /etc/init.d/sshd stop Stopping sshd: [ OK ] # service sshd status sshd (pid 26595 26593) is running... # ps -ef | grep ssh root 18430 18065 0 08:53 pts/1 00:00:00 grep --color ssh root 26593 1 0 Jan03 ? 00:00:00 sshd: happy [priv] happy 26595 26593 0 Jan03 ? 00:00:02 sshd: happy@pts/0 We know that no new connections will be accepted with this status but the status function should report that service is stopped. 2. State specific action requested of SEG As the status function is generic to all the init scripts and I agree that it can't be modified for a single script. However the additional functionally can be added. 3. Additional info This seems to be a limitation of using a common/generic "status" function via /etc/init.d/functions. The status function should also check /var/run/SERVICE.pid file or /var/lock/subsys/SERVICE, in this case /var/run/sshd.pid or /var/lock/subsys/sshd This should be more reliable, though can never be 100% accurate in representing the service status. We also understand that not all services would actually create these (pid file) upon startup hence the "status" function primarily checks for running processes. Also changing the behavior of the generic function could have cascading impact on all services using it. This event sent from IssueTracker by mpoole [Support Engineering Group] issue 161096 -- Additional comment from mpoole on 2008-01-30 07:32 EST -- Simple enough to fix, --- sshd.orig 2008-01-30 12:11:47.000000000 +0000 +++ sshd 2008-01-30 12:31:03.000000000 +0000 @@ -170,7 +170,7 @@ fi ;; status) - status $SSHD + status -p $PID_FILE $SSHD RETVAL=$? ;; *)
Actually status -p $PID_FILE openssh-daemon must be used otherwise it is not correct either.
This request was evaluated by Red Hat Product Management for inclusion, but this component is not scheduled to be updated in the current Red Hat Enterprise Linux release. If you would like this request to be reviewed for the next minor release, ask your support representative to set the next rhel-x.y flag to "?".
*** Bug 479838 has been marked as a duplicate of this bug. ***
Customer is also asking for this to be fixed in RHEL4.
I realize this is for ssh, but I seem to be running into a similar issue with trying to run a second instance of apache with a different init script and configuration file. The problem does appear to be with /etc/init.d/functions as it defaults to pidof for checking status on a program even when you specify a pidfile. It never even makes it to the pidfile check because it returns right away. status() { ............. # First try "pidof" pid="$(__pids_pidof "$1")" if [ -n "$pid" ]; then echo $"${base} (pid $pid) is running..." return 0 fi # Next try "/var/run/*.pid" files __pids_var_run "$1" "$pid_file" ............ } This causes "service <scriptname> status" to report the same pids as "service httpd status", I imagine if I was running multiple copies of sshd with different configurations that it would be the same issue.
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux.