nohup process doesn't keep running in background when used in python script -
i want run below mysql query on remote server in background.
nohup mysql -h10.0.100.1 -p3306 -utest -ppassword -dcms -e "select * table1 ;" & echo $!
when above command execute manually command line, see process running in background (table has records return response on 2 mins)
[root@test_server]# ps -ef | grep mysql
root 11144 9227 19 17:44 pts/0 00:00:01 mysql -h 10.0.100.1 -p 3306 -utest -px xxxxxxx -dcms -e select * table1 ;
however when use code in python script, don't see process running in background. not executing intended mysql command python code snippet:
cmd = "nohup mysql -h10.0.100.1 -p3306 -uroot -ppassword -dcms \ -e \"select * table1 ;\" & echo $!" out, err, code = ssh_client.execute_sudo_command(["%s" % cmd]) print out
it returns pid don't see process not running in background period of time intended run.
i have tried solution mentioned in https://github.com/brooklyncentral/brooklyn/issues/162 or http://en.wikipedia.org/wiki/nohup
ssh localhost 'nohup mysqld > out 2> err < /dev/null & echo $! > pid.txt ; exit 0'
but didn't worked out.
i using python 2.7.6 , sshclient remote connection. suggestions overcome issue?
Comments
Post a Comment