I have a problem with running non finishing process via ssh from python script. What I need to do:
- Connect to remote server via ssh
- Run mongod on this server
- Finish script execution without killing mongod process
For now, I'm using subprocess.Popen in this way:
subprocess.Popen(['ssh', 'user@' + host, 'mongod', '-f', '/temp-mongo.conf', '&'])
Problem is that script ends before I'm asked about user password, so it finishes with Too many authentication failures for root.
I tried to use p = subprocess.Popen(...).communicate() and it'a almost ok, but then script waits for mongod command to be finished, what obviously won't happen.
What is proper way to do this? Can I do something to pass password automatically?
systemctlor if you must have a hacky way,nohup xxx &