Skip to content

Instantly share code, notes, and snippets.

@ademalp
Last active December 14, 2015 11:59
Show Gist options
  • Save ademalp/5082951 to your computer and use it in GitHub Desktop.
Save ademalp/5082951 to your computer and use it in GitHub Desktop.
#!/bin/bash
sunucu="SERVER4"
eposta="admin@vizyon.net.tr"
uyari=12000
restart=15000
toplam=0
for val in $(ps -C httpd -o vsz=)
do
toplam=$(($toplam + $val))
done
toplammb=$((toplam/1024))
if [ "$toplammb" -ge "$uyari" ]; then
wget http://127.0.0.1/sstat -O /tmp/sstat.html && cat /tmp/sstat.html | mail -a "Content-type: text/html" -s "HTTPD STAT $sunucu" $eposta
echo "$toplammb" | mail -s "$sunucu - HTTPD BELLEK" $eposta
fi
if [ "$toplammb" -ge "$restart" ]; then
wget http://127.0.0.1/sstat -O /tmp/sstat.html && cat /tmp/sstat.html | mail -s "$sunucu - HTTPD STAT" $eposta
/etc/init.d/httpd restart 2&> /var/log/cron_httpd_mem.log && wget http://127.0.0.1/sstat -o && cat /var/log/cron_httpd_mem.log | mail -s "$sunucu - HTTPD RESTART : BELLEK" $eposta
fi
echo "$toplammb"
#exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment