
Originally Posted by
boomam
Does anyone know of a way to run a script that'll auto connect to a server via SSH (smoothwall), login and then perform a few commands, then close the SSH session.
As pointed out above, on Windows plink connecting with a key file should do it. I've actually had occasion to write a utility that does pretty much what you describe above, for which I used Python:
Code:
for fileLine in os.popen("PuTTY\\plink -batch -i PuTTY\\xenConsole.ppk root@" + dirName + " cat /proc/mdstat").readlines():
line = fileLine[:-1]
reResult = re.search(" *(.*) blocks \[(.*)/(.*)\] \[(.*)\]", line)
if reResult:
RAIDState = reResult.group(4)
The above connects to the server and gets the state of the mdadm RAID array, sorting through the answer with a regular expression to parse out the data needed.
--
David Hicks