Recent content by AGG2020

  1. A

    How to grep or awk or sed exact match in linux

    Not sure what exactly you need but I understand it as you want result 1 or 0 depending on if one or more servername are running or no one is running. If this is what you want use: ps -aux| grep servername | wc -l | awk '{ if($1>0) print 1; else print 0 }' or ps -aux| grep servername | wc -l |...
  2. A

    Script to send an alert mail once the disk space is above 90% sends disk full even when the disk isn't full, how to resolve this issue?

    I use this code to check for the list of disks that have >90% use: df -m | awk '$1 ~ "/dev/.*" { use=substr($5, 1, length($5)-1); if(int(use)>90) print $1 "(" use "%)"; }' Only disks from /dev/... are included (not tmpfs, etc.) but can be modified for any other disk name pattern. You can easily...
Top