I want linux script to kill java program running on console.
Following is the process running as jar.
[rapp@s1-dlap0 ~]$ ps -ef |grep java
rapp 9473
pkill -f for whatever reason does not work for me. Whatever that does, it seems very finicky about actually grepping through what ps aux shows me clearly is there.
After an afternoon of swearing I went for putting the following in my start script:
(ps aux | grep -v -e 'grep ' | grep MainApp | tr -s " " | cut -d " " -f 2 | xargs kill -9 ) || true