|
@@ -65,7 +65,7 @@ class Host(Thread):
|
|
|
ssh = subprocess.Popen( ["ssh", "%s" % self.hostname, command], shell = False, stdout = subprocess.PIPE, stderr = subprocess.PIPE )
|
|
|
return ssh
|
|
|
else:
|
|
|
- print (self.hostname + ' is not up.')
|
|
|
+ print(self.hostname + ' is not up.')
|
|
|
return False
|
|
|
|
|
|
def status(self):
|
|
@@ -83,11 +83,11 @@ class Host(Thread):
|
|
|
if not self.running:
|
|
|
startcmd = "startx /usr/bin/xfreerdp /cert-ignore /f /v:tolab.fisica.unimi.it &> /dev/null &"
|
|
|
self.sshcommand(startcmd)
|
|
|
- print ('xfreerdp started on ' + self.hostname)
|
|
|
+ print('xfreerdp started on ' + self.hostname)
|
|
|
else:
|
|
|
- print ('xfreerdp is already running on ' + self.hostname)
|
|
|
+ print('xfreerdp is already running on ' + self.hostname)
|
|
|
else:
|
|
|
- print (self.hostname + ' is not up.')
|
|
|
+ print(self.hostname + ' is not up.')
|
|
|
|
|
|
def xstop(self):
|
|
|
if self.up:
|
|
@@ -100,11 +100,11 @@ class Host(Thread):
|
|
|
pgrep -xf "$PCMDL" && \
|
|
|
pkill -9 -xf "$PCMDL"'''
|
|
|
self.sshcommand(stopcmd)
|
|
|
- print ('xfreerdp stopped on ' + self.hostname)
|
|
|
+ print('xfreerdp stopped on ' + self.hostname)
|
|
|
else:
|
|
|
- print ('xfreerdp is not running on ' + self.hostname)
|
|
|
+ print('xfreerdp is not running on ' + self.hostname)
|
|
|
else:
|
|
|
- print (self.hostname + ' is not up.')
|
|
|
+ print(self.hostname + ' is not up.')
|
|
|
|
|
|
Hosts = [
|
|
|
Host('abe', 'LCM1'),
|
|
@@ -142,8 +142,8 @@ nodes = []
|
|
|
# Show usage if no arguments
|
|
|
if len(sys.argv) < 2:
|
|
|
parser.print_usage()
|
|
|
- print ("\nSimple tool to handle xfreerdp on LCM nodes.")
|
|
|
- print ('\nTry: "xfreerdpctl --help" to display help message.')
|
|
|
+ print("\nSimple tool to handle xfreerdp on LCM nodes.")
|
|
|
+ print('\nTry: "xfreerdpctl --help" to display help message.')
|
|
|
sys.exit(1)
|
|
|
|
|
|
# Filter hostlist according to arguments
|
|
@@ -164,7 +164,7 @@ down=[]
|
|
|
|
|
|
num=len(nodes)
|
|
|
index=0
|
|
|
-print (' Querying ' + str(num) + ' hosts...')
|
|
|
+print(' Querying ' + str(num) + ' hosts...')
|
|
|
for i in nodes:
|
|
|
# Rejoin them when their work is done
|
|
|
i.join()
|
|
@@ -175,17 +175,17 @@ for i in nodes:
|
|
|
index += 1
|
|
|
print_progressbar(index, num)
|
|
|
# New line after progress bar
|
|
|
-print ('\n Done... (%(t).3f s)' % {'t': (time() - start)})
|
|
|
+print('\n Done... (%(t).3f s)' % {'t': (time() - start)})
|
|
|
|
|
|
if args.cmd == 'status':
|
|
|
if len(running):
|
|
|
- print ("xfreerdp is running on:")
|
|
|
- for i in running : print ('\t',i)
|
|
|
+ print("xfreerdp is running on:")
|
|
|
+ for i in running : print('\t',i)
|
|
|
else:
|
|
|
- print ("xfreerdp is not running")
|
|
|
+ print("xfreerdp is not running")
|
|
|
if len(down):
|
|
|
- print ("Down nodes:")
|
|
|
- for i in down : print ('\t',i)
|
|
|
+ print("Down nodes:")
|
|
|
+ for i in down : print('\t',i)
|
|
|
|
|
|
elif args.cmd == 'start':
|
|
|
for i in nodes: i.xstart()
|