I want execute the below unix comand to kill the process
COMMAND : ps -ef | grep "PROCESS_NAME " | xargs kill -9
when i am trying to execute the below gradle task its not running
task Execute(type: Exec) {
commandLine “ps”, “auwx” , “|” , “grep” ,"PROCESS_NAME "
}
its throwing error :
ps: illegal argument: | usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid…]]
[-u]
[-p pid[,pid…]] [-t tty[,tty…]] [-U user[,user…]]
ps [-L]
Please help me "How to execute the unix command with pipe and kill the unix process with pid ?