Re: Create new processes over telnet in XP
Shane Geiger a écrit : This reminds me of something I once wanted to do: How can I install Python in a totally non-gui way on Windows (without the use of VNC)? I think I was telnetted into a computer (or something like that) and I was unable to run the usual Python installer because it uses a GUI. Take a look at PortablePython, this may be the easy solution... http://www.portablepython.com/ A+ Laurent. -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
Laurent Pointal wrote: Shane Geiger a écrit : This reminds me of something I once wanted to do: How can I install Python in a totally non-gui way on Windows (without the use of VNC)? I think I was telnetted into a computer (or something like that) and I was unable to run the usual Python installer because it uses a GUI. While I don't remember if I've actually tried it you should be able to do this with WMI. Example here... http://timgolden.me.uk/python/wmi_cookbook.html#install-a-product If I have time to do it (and then undo whatever damage it does ;) I'll give it a go later. TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
Tim Golden wrote: Laurent Pointal wrote: Shane Geiger a écrit : This reminds me of something I once wanted to do: How can I install Python in a totally non-gui way on Windows (without the use of VNC)? I think I was telnetted into a computer (or something like that) and I was unable to run the usual Python installer because it uses a GUI. While I don't remember if I've actually tried it you should be able to do this with WMI. Example here... http://timgolden.me.uk/python/wmi_cookbook.html#install-a-product If I have time to do it (and then undo whatever damage it does ;) I'll give it a go later. TJG Or, indeed, just run it in quiet mode, according to the docs: http://www.python.org/download/releases/2.5/msi/ TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
Irmen de Jong schrieb: Shane Geiger wrote: This reminds me of something I once wanted to do: How can I install Python in a totally non-gui way on Windows (without the use of VNC)? I think I was telnetted into a computer (or something like that) and I was unable to run the usual Python installer because it uses a GUI. Python uses a MSI (microsoft installer) based installer on windows. This was introduced in version 2.5 I believe. For MSI installers there's the standard MSI-way to perform a silent install. Google for it, I don't know what the command line switch(es) are, but they're there. --Irmen Even the Wise installer that was used to build the 2.3 and earlier versions had command line switches to do silent installs. THomas -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
Godzilla [EMAIL PROTECTED] writes: Rob, I would be logging into another XP machine to do some software I was afraid of that. :) installation... the code you provided, correct me if I'm wrong, seems to work under Unix/Linux. This part of running and killing processes, yes. Any idea how to do the equivalent in XP? You could use windows services, for example: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/115875 But I don't know details, because this is not my favourite OS. :) -- Regards, Rob -- http://mail.python.org/mailman/listinfo/python-list
Create new processes over telnet in XP
Hello, How do you create/spawn new processes in XP over telnet using python? I.e. I would like to create a new process and have it running in the background... when I terminate the telnet connection, I would what the spawned processes to keep running until I shut it off... I got the os.popen method to spawn a new process running in the backgroun, but not over telnet... tried os.popen[2, 3, 4] and also subprocesses.popen without any luck... Any help will be appreciated... thankyou. -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
You could use pexpect module. Open a telnet session Then run the script in nohup mode It's assumed that the binary is available over there On 23 Mar 2007 03:47:14 -0700, Godzilla [EMAIL PROTECTED] wrote: Hello, How do you create/spawn new processes in XP over telnet using python? I.e. I would like to create a new process and have it running in the background... when I terminate the telnet connection, I would what the spawned processes to keep running until I shut it off... I got the os.popen method to spawn a new process running in the backgroun, but not over telnet... tried os.popen[2, 3, 4] and also subprocesses.popen without any luck... Any help will be appreciated... thankyou. -- http://mail.python.org/mailman/listinfo/python-list -- Regards-- Rishi Pathak National PARAM Supercomputing Facility Center for Development of Advanced Computing(C-DAC) Pune University Campus,Ganesh Khind Road Pune-Maharastra -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
Godzilla wrote: Hello, How do you create/spawn new processes in XP over telnet using python? I.e. I would like to create a new process and have it running in the background... when I terminate the telnet connection, I would what the spawned processes to keep running until I shut it off... I got the os.popen method to spawn a new process running in the backgroun, but not over telnet... tried os.popen[2, 3, 4] and also subprocesses.popen without any luck... I don't know what kind of OS there is on that remote host you telnet to. The idea boils down to appropriate using of methods `read_until` and `write` from class `telnetlib.Telnet`. For more complicated stuff you can consider using pyexpect. Here is a small example of connecting to HP-UX. You can adjust that to your needs. code import telnetlib, time def login(tn, login, passwd, prompt): tn.read_until(login: ) tn.write(login + \n) if passwd: tn.read_until(Password: ) tn.write(passwd + \n) tn.read_until(prompt) time.sleep(2) print logged in def run_proc(tn, progname): tn.write(nohup %s \n % progname) tn.write(exit\n) print program %s running % progname def kill_proc(tn, login, prompt, progname): tn.write(ps -u %s\n % login) buf = tn.read_until(prompt) pid = get_pid(buf, progname) if not pid: print program %s not killed % progname tn.write(exit\n) return tn.write(kill -TERM %s\n % pid) tn.write(exit\n) print program %s killed % progname def get_pid(buf, progname): pid, comm = None, None for line in buf.split(\n): try: pid, _, _, comm = line.split() except ValueError: continue if comm == progname: return pid tn = telnetlib.Telnet(HOST, PORT) #tn.set_debuglevel(1) login(tn, login, passwd, /home/user) run_proc(tn, python ~/test.py) #kill_proc(tn, login, /home/user, python) /code -- HTH, Rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
On 23 Mar 2007 03:47:14 -0700, Godzilla [EMAIL PROTECTED] wrote: Hello, How do you create/spawn new processes in XP over telnet using python? I.e. I would like to create a new process and have it running in the background... Ssh -- or even rsh -- are better choices than telnet for these things. For some reason, they are not standard in Windows, though. ssh somewhere some command with arguments rsh somewhere some command with arguments compared to telnet somewhere and then performing expect-like things (basically simulating someone typing some command with arguments in the telnet session). when I terminate the telnet connection, I would what the spawned processes to keep running until I shut it off... That's a function of the remote OS; what happens when its terminal goes away is not under the control of the client side. /Jorgen -- // Jorgen Grahn grahn@Ph'nglui mglw'nafh Cthulhu \X/ snipabacken.dyndns.org R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
Jorgen Grahn wrote: On 23 Mar 2007 03:47:14 -0700, Godzilla [EMAIL PROTECTED] wrote: Hello, How do you create/spawn new processes in XP over telnet using python? I.e. I would like to create a new process and have it running in the background... Ssh -- or even rsh -- are better choices than telnet for these things. For some reason, they are not standard in Windows, though. ssh somewhere some command with arguments rsh somewhere some command with arguments compared to telnet somewhere and then performing expect-like things (basically simulating someone typing some command with arguments in the telnet session). + for an sshd running as a service under XP, look at CopSSH. + hope started process doesn't want a GUI... else, look at UltraVNC running as daemon, and port redirection using ssh. when I terminate the telnet connection, I would what the spawned processes to keep running until I shut it off... That's a function of the remote OS; what happens when its terminal goes away is not under the control of the client side. Maybe the process starting job can be done by a Python program running as Windows service and waiting for requests on a port (or Pyro object or Corba object...). No need for telnet/ssh connection, no logout problem. Just care of possible security problems :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
This reminds me of something I once wanted to do: How can I install Python in a totally non-gui way on Windows (without the use of VNC)? I think I was telnetted into a computer (or something like that) and I was unable to run the usual Python installer because it uses a GUI. Laurent Pointal wrote: Jorgen Grahn wrote: On 23 Mar 2007 03:47:14 -0700, Godzilla [EMAIL PROTECTED] wrote: Hello, How do you create/spawn new processes in XP over telnet using python? I.e. I would like to create a new process and have it running in the background... Ssh -- or even rsh -- are better choices than telnet for these things. For some reason, they are not standard in Windows, though. ssh somewhere some command with arguments rsh somewhere some command with arguments compared to telnet somewhere and then performing expect-like things (basically simulating someone typing some command with arguments in the telnet session). + for an sshd running as a service under XP, look at CopSSH. + hope started process doesn't want a GUI... else, look at UltraVNC running as daemon, and port redirection using ssh. when I terminate the telnet connection, I would what the spawned processes to keep running until I shut it off... That's a function of the remote OS; what happens when its terminal goes away is not under the control of the client side. Maybe the process starting job can be done by a Python program running as Windows service and waiting for requests on a port (or Pyro object or Corba object...). No need for telnet/ssh connection, no logout problem. Just care of possible security problems :-) -- Shane Geiger IT Director National Council on Economic Education [EMAIL PROTECTED] | 402-438-8958 | http://www.ncee.net Leading the Campaign for Economic and Financial Literacy begin:vcard fn:Shane Geiger n:Geiger;Shane org:National Council on Economic Education (NCEE) adr:Suite 215;;201 N. 8th Street;Lincoln;NE;68508;United States email;internet:[EMAIL PROTECTED] title:IT Director tel;work:402-438-8958 x-mozilla-html:FALSE url:http://www.ncee.net version:2.1 end:vcard -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
Shane Geiger wrote: This reminds me of something I once wanted to do: How can I install Python in a totally non-gui way on Windows (without the use of VNC)? I think I was telnetted into a computer (or something like that) and I was unable to run the usual Python installer because it uses a GUI. Python uses a MSI (microsoft installer) based installer on windows. This was introduced in version 2.5 I believe. For MSI installers there's the standard MSI-way to perform a silent install. Google for it, I don't know what the command line switch(es) are, but they're there. --Irmen -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
Irmen de Jong napisał(a): Python uses a MSI (microsoft installer) based installer on windows. This was introduced in version 2.5 I believe. 2.4? I recall that we installed 2.4.2 this way on 500 machines some day at my previous work. -- Jarek Zgoda http://jpa.berlios.de/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
On Mar 24, 12:57 am, Rob Wolfe [EMAIL PROTECTED] wrote: Godzilla wrote: Hello, How do you create/spawn new processes in XP over telnet using python? I.e. I would like to create a new process and have it running in the background... when I terminate the telnet connection, I would what the spawned processes to keep running until I shut it off... I got the os.popen method to spawn a new process running in the backgroun, but not over telnet... tried os.popen[2, 3, 4] and also subprocesses.popen without any luck... I don't know what kind of OS there is on that remote host you telnet to. The idea boils down to appropriate using of methods `read_until` and `write` from class `telnetlib.Telnet`. For more complicated stuff you can consider using pyexpect. Here is a small example of connecting to HP-UX. You can adjust that to your needs. code import telnetlib, time def login(tn, login, passwd, prompt): tn.read_until(login: ) tn.write(login + \n) if passwd: tn.read_until(Password: ) tn.write(passwd + \n) tn.read_until(prompt) time.sleep(2) print logged in def run_proc(tn, progname): tn.write(nohup %s \n % progname) tn.write(exit\n) print program %s running % progname def kill_proc(tn, login, prompt, progname): tn.write(ps -u %s\n % login) buf = tn.read_until(prompt) pid = get_pid(buf, progname) if not pid: print program %s not killed % progname tn.write(exit\n) return tn.write(kill -TERM %s\n % pid) tn.write(exit\n) print program %s killed % progname def get_pid(buf, progname): pid, comm = None, None for line in buf.split(\n): try: pid, _, _, comm = line.split() except ValueError: continue if comm == progname: return pid tn = telnetlib.Telnet(HOST, PORT) #tn.set_debuglevel(1) login(tn, login, passwd, /home/user) run_proc(tn, python ~/test.py) #kill_proc(tn, login, /home/user, python) /code -- HTH, Rob Thanks guys for your input... Rob, I will give your example a go soon and tell you how i go... Have a nice day... -- http://mail.python.org/mailman/listinfo/python-list
Re: Create new processes over telnet in XP
On Mar 24, 12:57 am, Rob Wolfe [EMAIL PROTECTED] wrote: Godzilla wrote: Hello, How do you create/spawn new processes in XP over telnet using python? I.e. I would like to create a new process and have it running in the background... when I terminate the telnet connection, I would what the spawned processes to keep running until I shut it off... I got the os.popen method to spawn a new process running in the backgroun, but not over telnet... tried os.popen[2, 3, 4] and also subprocesses.popen without any luck... I don't know what kind of OS there is on that remote host you telnet to. The idea boils down to appropriate using of methods `read_until` and `write` from class `telnetlib.Telnet`. For more complicated stuff you can consider using pyexpect. Here is a small example of connecting to HP-UX. You can adjust that to your needs. code import telnetlib, time def login(tn, login, passwd, prompt): tn.read_until(login: ) tn.write(login + \n) if passwd: tn.read_until(Password: ) tn.write(passwd + \n) tn.read_until(prompt) time.sleep(2) print logged in def run_proc(tn, progname): tn.write(nohup %s \n % progname) tn.write(exit\n) print program %s running % progname def kill_proc(tn, login, prompt, progname): tn.write(ps -u %s\n % login) buf = tn.read_until(prompt) pid = get_pid(buf, progname) if not pid: print program %s not killed % progname tn.write(exit\n) return tn.write(kill -TERM %s\n % pid) tn.write(exit\n) print program %s killed % progname def get_pid(buf, progname): pid, comm = None, None for line in buf.split(\n): try: pid, _, _, comm = line.split() except ValueError: continue if comm == progname: return pid tn = telnetlib.Telnet(HOST, PORT) #tn.set_debuglevel(1) login(tn, login, passwd, /home/user) run_proc(tn, python ~/test.py) #kill_proc(tn, login, /home/user, python) /code -- HTH, Rob Rob, I would be logging into another XP machine to do some software installation... the code you provided, correct me if I'm wrong, seems to work under Unix/Linux. Any idea how to do the equivalent in XP? -- http://mail.python.org/mailman/listinfo/python-list