Executing Commands From Windows Service

T misceverything at gmail.com
Sun Feb 7 16:51:19 EST 2010


On Feb 7, 4:43 pm, Sean DiZazzo <half.ital... at gmail.com> wrote:
> On Feb 7, 11:02 am, T <misceveryth... at gmail.com> wrote:
>
> > I have a script, which runs as a Windows service under the LocalSystem
> > account, that I wish to have execute some commands.  Specifically, the
> > program will call plink.exe to create a reverse SSH tunnel.  Right now
> > I'm using subprocess.Popen to do so.  When I run it interactively via
> > an admin account, all is well.  However, when I'm running it via
> > service, no luck.  I'm assuming this is to do with the fact that it's
> > trying to run under the LocalSystem account, which is failing.  What
> > would be the best way around this?  Thanks!
>
> Try running/debugging your service from the commandline as
> "<servicename> debug"  That should lead you to the error.
>
> Otherwise, we need to see a traceback and some code to be better able
> to help.
>
> ~Sean

It's working fine when I run it via "<servicename> debug" - that's how
I was testing before.  It's when I start the service that it fails -
and you can see that, when you run it with debug, plink.exe runs under
my username.  When I run it as a service, it runs under System...



More information about the Python-list mailing list