Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is oneliner to check that SWAP space on current PC is less than 20 of usage.
- # If it is less, then it sends email from [email protected] address to [email protected] address
- # via the smtp.aaanet.ru server (change to your favourite) with subject "email-topic"
- # and text "email text". It is useful to check if server load drops or some application exited incorrectly.
- a=$(free | grep Swap | awk -F" " '{print $2}');b=$(free | grep Swap | awk -F" " '{print $3}'); c=$(echo "scale=2; $b/$a*100" | bc | awk -F. '{print $1}'); if [ $c -lt 20 ]; then sendemail -f from@email.com -t to@email.com -u email-topic -m "email text" -s smtp.aaanet.ru; fi
- # Don't forget to change email addresses and smtp server if needed.
Advertisement
Add Comment
Please, Sign In to add comment