Re: Python script for remotely shutting down Windows PC from Linux ?
- From: "Diez B. Roggisch" <deets@xxxxxxxxxxxxx>
- Date: Tue, 16 May 2006 15:28:57 +0200
Next, I wrote a script that would log me in and also shut the windows
pc down, so I wrote a script
ssh Admin@IP_ADDR # connects me fine now without problems (LOCAL)
shutdown -s # This is a windows command (REMOTE)
Now, when I run this script, it successfully logs me into the windows
box but doesn't run the second part of the script which is to shut down
the windows PC. Can you please tell me why ??
Because you execute both commands locally. ssh opens a connection to the
remote machine. Then if that connection is terminated, the next command is
executed. LOCALLY!
Use
ssh Admin@IP_ADDR shutdown -s
to execute commands remote using ssh.
Is there a way using Python script to perform this operation ?
use the subprocess module or shellutils to execute the above.
Diez
.
- Follow-Ups:
- Re: Python script for remotely shutting down Windows PC from Linux ?
- From: diffuser78
- Re: Python script for remotely shutting down Windows PC from Linux ?
- References:
- Python script for remotely shutting down Windows PC from Linux ?
- From: diffuser78
- Python script for remotely shutting down Windows PC from Linux ?
- Prev by Date: Re: Google-API Bad-Gateway-Error
- Next by Date: Re: Large Dictionaries
- Previous by thread: Python script for remotely shutting down Windows PC from Linux ?
- Next by thread: Re: Python script for remotely shutting down Windows PC from Linux ?
- Index(es):
Relevant Pages
|
|