|
|
@@ -3,6 +3,9 @@ import json
|
|
3
|
3
|
import paramiko
|
|
4
|
4
|
import time
|
|
5
|
5
|
from tkinter import messagebox
|
|
|
6
|
+import os
|
|
|
7
|
+
|
|
|
8
|
+from paramiko import file
|
|
6
|
9
|
|
|
7
|
10
|
|
|
8
|
11
|
window = tkinter.Tk()
|
|
|
@@ -40,13 +43,32 @@ def sshConnect(cs, sd):
|
|
40
|
43
|
def sshQuit(cs, sd):
|
|
41
|
44
|
cs = cs
|
|
42
|
45
|
sd = sd
|
|
43
|
|
- ssh = paramiko.SSHClient()
|
|
44
|
|
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
45
|
|
- ssh.connect(settings[4],port= settings[3], username=settings[5], password=settings[6])
|
|
|
46
|
+
|
|
|
47
|
+ filepath = './log.txt'
|
|
46
|
48
|
data_root_dir = './data/'+cs+sd
|
|
47
|
49
|
|
|
|
50
|
+ f = open(filepath, 'w')
|
|
|
51
|
+ f.write('record succesfully stopped')
|
|
|
52
|
+ f.close()
|
|
|
53
|
+
|
|
|
54
|
+
|
|
|
55
|
+ transport = paramiko.Transport((settings[4], settings[3]))
|
|
|
56
|
+ transport.connect(username=settings[5], password=settings[6])
|
|
|
57
|
+ sftp = paramiko.SFTPClient.from_transport(transport)
|
|
|
58
|
+ sftp.put(filepath, data_root_dir + filepath[1:])
|
|
|
59
|
+ sftp.close()
|
|
|
60
|
+ transport.close()
|
|
|
61
|
+ os.remove(filepath)
|
|
|
62
|
+
|
|
|
63
|
+
|
|
|
64
|
+ ssh = paramiko.SSHClient()
|
|
|
65
|
+ ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
|
66
|
+ ssh.connect(settings[4],port= settings[3], username=settings[5], password=settings[6])
|
|
48
|
67
|
stdin, stdout, stderr = ssh.exec_command('docker stop mail_recorder')
|
|
49
|
|
- stdin, stdout, stderr = ssh.exec_command('mv '+data_root_dir + ' /hdd/')
|
|
|
68
|
+ time.sleep(10)
|
|
|
69
|
+ stdin, stdout, stderr = ssh.exec_command('mv ' + data_root_dir + ' /hdd/')
|
|
|
70
|
+
|
|
|
71
|
+
|
|
50
|
72
|
|
|
51
|
73
|
|
|
52
|
74
|
label_branch = tkinter.Label(window, text = '지점 위치: ' + settings[2] + ' / 수술방 번호: ' + str(settings[3]))
|