I'm currently trying to kill any program that has run over 48 hours with the name "cool-program"
I understand that if I run
ps -eo pid,cmd,comm,etime | grep -i cool-program | grep -v grep
it gives me a list of the programs, now I'm not sure how to further filter this to only programs that have been running over a day
given the comments to have it print out a list of the pid
of cool program I'm using but when I try and pipe this to kill
it does not kill the programs
ps -eo bsdstart,pid,comm | grep -i ffmpeg | grep -v '^[ 0-9]' | awk '{ print $3 }'
In the man page for
ps
it states if you usebsdstart
it will show the time the command started:Then you can use a combined command to pull the date, pid, and the command running and using grep to exclude
-v
the lines that start with numbers or spaces then numbers like so:To kill them the command would be:
Hope this helps!