Rsh and background execution PB
jean-Baptiste Cazier
jcazier at decode.is
Tue Jun 10 12:02:35 EDT 2003
Hi !
I am trying to run a python script in the background executing
regurlary a remote command.
However if I try to run the script in the background, it is suspended
as soon as it starts. But it works fine in the foreground.
Below is a simplified version of the problem
-------------------------------
#!/usr/bin/python
import os
import string
def main():
print "start rsh"
# os.system('rsh lcs301 "ls" ')
try:
lines = string.split(os.popen('rsh lcs301 "ls|head"
').read(),'\n')
except :
print "error"
for i in lines[:-1]:
print i
return 0
if __name__ =="__main__":
main()
---------------------------------
And the command line looks like this:
No problem in foreground:
~/devel/queue $ pb.py
start rsh
41256904005028C06DB9DE8487E42B69C1256C2A0048FE7A_VT367501_C300Z_A2_GM1_0409.pdf
718913.lcs3.ER
718913.lcs3.OU
718937.lcs3.ER
718937.lcs3.OU
AgronomDanisco.doc
C11-markers-f-JB.xls
C11.map
CS-2002-17.ps
CazierNIHBio_JT.2.doc
But in the background:
~/devel/queue $ pb.py &
[1] 24541
~/devel/queue $ start rsh
[1]+ Stopped pb.py
~/devel/queue $ fg
pb.py
41256904005028C06DB9DE8487E42B69C1256C2A0048FE7A_VT367501_C300Z_A2_GM1_0409.pdf
718913.lcs3.ER
718913.lcs3.OU
718937.lcs3.ER
718937.lcs3.OU
AgronomDanisco.doc
C11-markers-f-JB.xls
C11.map
CS-2002-17.ps
CazierNIHBio_JT.2.doc
Any solution to the problem ?
Thanks
KveĆ°ja
Jean-Baptiste
More information about the Python-list
mailing list