0

PythonApp A starts PythonApp B on a remote server and terminates if the B has been successfully started.

The following command works fine, there is no problem.

cmd = "ssh -o GSSAPIAuthentication=no -o ForwardX11=no myuser@myserver nohup python3 -m secondapp -vv < /dev/null 2> /dev/null > /dev/null &" subprocess.Popen(cmd)

However, if for instance passwordless ssh is not setup, the B will not start properly.

What are alternative ways to start B and to terminate A only once it has been verified B is running.

Stefan Papp
  • 2,199
  • 1
  • 28
  • 54
  • 1
    write a file and wait for it to exist ... run ps and search your program name ... its running riught away ... there is no way to guarantee it wont "crash" after whatever check you put in place(see halting problem) – Joran Beasley Jun 22 '18 at 14:55
  • you should be able too look at the exist code and tell if the command execute successfully see https://stackoverflow.com/a/7575366/1265980 – Ereli Jun 22 '18 at 15:01
  • Another options would using a python package to manage the ssh connect, this would allow you more control. see this Paramiko example: https://stackoverflow.com/a/28411997/1265980 – Ereli Jun 22 '18 at 15:05

0 Answers0