how to test sshd running ?

Larry Hall (Cygwin) reply-to-list-only-lh@cygwin.com
Mon Dec 18 16:48:00 GMT 2006


kato fong wrote:
> Hi,
>> I want to write a sh script that executes itself if sshd is not running.
>> But what is the reliable way to test if I get sshd running under
> cygwin/windows95?

This isn't a Cygwin-specific question. As such, discussion of it is
really off-topic for this list.
That said, the following should work (untested on Cygwin or W95):
#! /bin/bash
ps -C sshd >& /dev/null
if [ $? -eq 0 ]
then
 echo sshd running
else
 echo sshd not running
fi
It's wordy but you get the idea. ;-)
-- 
Larry Hall http://www.rfk.com
RFK Partners, Inc. (508) 893-9779 - RFK Office
216 Dalton Rd. (508) 893-9889 - FAX
Holliston, MA 01746
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /