Browse Source

Implemented safer stop command.

Matteo Savatteri 5 years ago
parent
commit
5cb5a27f84
1 changed files with 7 additions and 1 deletions
  1. 7 1
      xfreerdpctl

+ 7 - 1
xfreerdpctl

@@ -94,7 +94,13 @@ class Host(Thread):
     def xstop(self):
         if self.up:
             if self.running:
-                stopcmd = "pkill xfreerdp"
+                # Try to kill sending SIGTERM, wait, check if running and if so issue SIGKILL.
+                # (Do this asynchronously, on the remote node)
+                stopcmd = '''PCMDL="/usr/bin/xfreerdp /cert-ignore /f /v:tolab.fisica.unimi.it"
+                             pkill -xf "$PCMDL"
+                             sleep 5
+                             pgrep -xf "$PCMDL" && \
+                             pkill -9 -xf "$PCMDL"'''
                 self.sshcommand(stopcmd)
                 print 'xfreerdp stopped on ' + self.hostname
             else: