Mailinglist Archive: opensuse (3513 mails)

< Previous Next >
[opensuse] BASH help - Better way to test if remote host running openSuSE or windows?
  • From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
  • Date: Sun, 11 Jan 2009 12:03:06 -0600
  • Message-id: <496A345A.50205@xxxxxxxxxxxxxxxxxx>
Listmates;

I'm looking for a quick test to see whether a remote host is running
Linux
(openSuSE) or windows. One test I have come up with is:

SERVER="//${1:-nirvana}"

if ssh ${SERVER} "cat /etc/SuSE-release" > /dev/null 2>&1; then
echo "${SERVER} running linux"
else
echo "${SERVER} running windows"
fi

Then for testing whether samba is available, I have:

if smbclient -U% -L${SERVER} >/dev/null 2>&1; then
echo -e "\n\t${SERVER} up and samba connection available\n"
else
echo -e "\n\t${SERVER} samba connection NOT available\n"
fi

I know there must be a cleaner or quicker way. Does anyone else have a
favorite way to testing the OS on a remote host they wouldn't mind sharing?

--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
This Thread
Follow Ups