In my system , there are a system user "cronusr" , it is mainly to run the crontab job in the database .Sometimes the cronjob process will be failure ( due to some reason ) so that many cronusr process are in the system , it affect other process in the system ,
I want to have a script that can kill the process - the process owner is cronusr and it is idle for one hour ( I think it can check by ps -aux |grep pid , if the status is R , then it is running , if it is S , then it is sleep and the process can be termiated ) , could suggest the script for the case ? thx in advance.