AmadeusITGroup/JumpSSH

Could not run command in background

jufei opened this issue · 1 comments

jufei commented

hi:
I need to start a process in background, so I run it like below:

from jumpssh import SSHSession
ssh_session = SSHSession('10.108.231.199', 'toor4nsn', password='oZPS0POrRieRtu').open()
ssh_session.run_cmd(cmd='ps -ef|grep tcpdump', silent=False, continuous_output=True)
ssh_session.run_cmd(cmd='nohup tcpdump -i br1 sctp  -w /tmp/local.pcap >/dev/null 2>/dev/null &', silent=False, continuous_output=True)
ssh_session.run_cmd(cmd='ps -ef|grep tcpdump', silent=False, continuous_output=True)

The output is:

[root@Server_130 lib_bts]# python3 ../try/a.py
root      2655  2646  0 10:47 pts/1    00:00:00 bash -c ps -ef|grep tcpdump
root      2657  2655  0 10:47 pts/1    00:00:00 grep tcpdump

root      2663  2646  0 10:47 pts/1    00:00:00 bash -c ps -ef|grep tcpdump
root      2665  2663  0 10:47 pts/1    00:00:00 grep tcpdump

Would you please help to check why?
Thanks.

jufei commented

Forget it, I got another solution.