conversing with the shell

Michaell Taylor michaell.taylor at reis.com
Mon Nov 19 20:47:40 CET 2001



I am looking to build a VERY simple load balance app for batch job submission 
on several linux machines.  The basic structure that I have in mind is.

For M in list_of_machines:
	fm = 'rsh '+M+' "cat /proc/meminfo"'
	fcpu = 'rsh '+M+' uptime'
	freemem = SOMECOMMAND(fm)
	freecpu = SOMECOMMAND(fcpu)
	.
	.
	parse output of freemem and freecpu
	.
	.
	.
select machine
submit job using rsh

BUT...

Problem is of course the SOMECOMMAND lines.  I need to query the shell for 
input and then read that input in as a variable.  I could use the shell 
commands to redirect the output to a file and then read the file with python, 
but this seems like a waste.

FYI, there are only 6-8 machines and fairly low frequency usage, so larger 
load balancing seems like overkill.

Thanks in advance

Michaell

	




More information about the Python-list mailing list