Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- free=$(free -mt | grep Total | awk '{print $4}')
- if [ $free -lt 256 ]; then
- date
- echo Warning, free memory is ${free} mb only.
- date
- fi
- [root@server ~]# sh /tools/mem.sh
- Fri Dec 19 11:19:44 CET 2014
- Warning, free memory is 245 mb only.
- Fri Dec 19 11:19:45 CET 2014
- sh /tools/mem.sh | mail -s "Server Low Memory" email@me.com
- sh /tools/mem.sh 2>&1 > /dev/null | mail -s "Server Low Memory" email@me.com
- sh /tools/mem.sh > /dev/null | mail -s "Server Low Memory" email@me.com
- sh /tools/mem.sh >/dev/null 2>/tools/mem.txt ; if [ -s /tools/mem.txt ] ; then mail -s "Server Low Memory" < /tools/mem.txt email@me.com ; fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement