Within a python script I need to launch a command such as
kill $(ps aux | grep httpd | awk '{print $2}')
Using subprocess I have tried to split the command using a function from https://stackoverflow.com/a/29755431/1355628)
The function is fine with simple commands with pipe but unfortunately with the one above it does not seem to work (the return code seems to be completely random...)
Thanks is advance