linux - Shell scripting for process count -
i need shell script display process counts in prod , pre-prod environments, excluding root user's processes. should send email if count exceeds 400.
how write this?
get count of processes , after that:
count=$(ps -efh | gawk '{ if(nr > 1){ print $1 }}' | grep -v 'root' | wc -l) if [ "$count" -gt 400 ]; # send emails fi
Comments
Post a Comment