forked from atupal/3gqq
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add run_server_script.py so it is easy to execute the script on remot…
…e host(windows azure)
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import paramiko | ||
|
||
pkey_file = '/home/atupal/.ssh/id_rsa' | ||
hostname = '168.63.179.223' | ||
port = 56369 | ||
|
||
key = paramiko.RSAKey.from_private_key_file(pkey_file) | ||
|
||
client = paramiko.SSHClient() | ||
client.load_system_host_keys() | ||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | ||
|
||
client.connect(hostname, port, pkey=key) | ||
|
||
|
||
import os | ||
os.system('scp -P 56369 server_dianzan.py atupal@168.63.179.223:~/ts.py') | ||
|
||
stdin, stdout, stderr = client.exec_command('pkill -9 python') | ||
stdin, stdout, stderr = client.exec_command('nohup python ts.py &') | ||
|
||
client.close() | ||
|
||
#import subprocess | ||
#P = subprocess.Popen() | ||
|
||
os.system('scp -P 56369 atupal@168.63.179.223:~/img.jpg img.gif') | ||
|
||
from PIL import Image | ||
image = Image.open('./img.gif') | ||
image.show() | ||
|
||
with open('verify', 'w') as fi: | ||
fi.write(raw_input('verify:')) | ||
|
||
os.system('scp -P 56369 verify atupal@168.63.179.223:~/verify') |