Mar-11-2020, 09:30 AM
1]i am using python 2.6.6
2]i need to execute a linux command { tail -f file1 -f file2 | egrep --line-buffered "string1|string2" > tofile.txt &} in background.
3]when executing the command on a linux shell, i could see the pid's as "[1] 2740 2741" but, i am not able to read this output through subprocess.Popen, os.popen and commands.getstatusoutput. commands give error as "syntax error near unexpected token '&' and others give empty string as output and command is running the background successfully though.
4]subprocess.Popen gives a pid but when killed or terminated i could still see the tail and egrep pid's staying alive.
5]how to kill/terminate all these processes ?
2]i need to execute a linux command { tail -f file1 -f file2 | egrep --line-buffered "string1|string2" > tofile.txt &} in background.
3]when executing the command on a linux shell, i could see the pid's as "[1] 2740 2741" but, i am not able to read this output through subprocess.Popen, os.popen and commands.getstatusoutput. commands give error as "syntax error near unexpected token '&' and others give empty string as output and command is running the background successfully though.
4]subprocess.Popen gives a pid but when killed or terminated i could still see the tail and egrep pid's staying alive.
5]how to kill/terminate all these processes ?