Executing Commands From Windows Service
misceverything at gmail.com
Mon Feb 8 17:37:38 CET 2010
On Feb 8, 1:28 am, Sean DiZazzo <half.ital... at gmail.com> wrote:
> On Feb 7, 4:57 pm, T <misceveryth... at gmail.com> wrote:
> > Thanks for the suggestions - I think my next step is to try running
> > it under an admin user account, as you guys both mentioned. Alf -
> > you're absolutely right, Microsoft has srvany.exe, which allows you to
> > run any EXE as a Windows service. I've done this in the past, but
> > it's more of a "hack"..so this go around (since I will be distributing
> > this program), I wanted to go the more professional route..which,
> > unfortunately, involves learning the "scum". :) I posted this to
> > comp.os.ms-windows.programmer.win32, so we'll see if what the Win32
> > programmers have to say as well. Thanks again!
> I use windows services and they are very reliable. I would say though
> that relying on plink.exe is much less reliable than either python or
> the service that it is running under.
> Why not take a look at paramiko as the ssh client library? I think it
> runs under windows. Also perhaps Twisted has something. Either way
> would be light years ahead of using subprocess with plink.
> Just my thoughts.
I totally agree that it would be much more reliable to use a Python
library for SSH - however, the program will need to execute other
external binaries as well. So my goal at this point is to track down
_why_ it's failing when running as a service. The actual command is
C:\plink.exe -R 9999:127.0.0.1:2020 -batch -i C:\keyfile.ppk
user at 10.10.10.1
I tried having subprocess.Popen run plink.exe by itself and piping
output to file, and this worked - so I know it's at least executing
plink.exe. Sorry, I realize this isn't truly just a Python-related
question, but any help would be greatly appreciated! So far no help
More information about the Python-list