I have several java processes but only those problematic I would like to kill periodically on every 2 minutes on Centos7.
I would like to kill process PIDs which are run over this command.
/var/tmp/java -c /var/tmp/w.conf
If I try kill
using the process ID process is killed automatically.
If I try to run this:
kill $(ps aux | grep 'java -c '| awk '{print $2}')
I am getting result:
-bash: kill: (129253) - No such process
how I should define script and crontab to kill automatically those processes?
Use
pkill -f '/var/tmp/java -c /var/tmp/w.conf'