Cron Restart Apache

Cron Restart Apache - Computer Issues, Video Gaming - Posted: 12th Jan, 2008 - 11:52pm

Text RPG Play Text RPG ?
 

Posts: 1 - Views: 1514
12th Jan, 2008 - 11:52pm / Post ID: #

Cron Restart Apache

Cron Restart Apache

I would like to thank devonblzx for creating a short script that can restart the system automatically if you reach below 'x' ram.

CODE
#!/bin/bash
# MAXRAM is in MB
MAXRAM=500
USEDRAM2=`cat /proc/user_beancounters | grep privvmpages | awk{'print $2'}`
USEDRAM=`echo "$USEDRAM2 / 256" | bc`
if [ "$USEDRAM" -ge "$MAXRAM" ]
then
/etc/init.d/httpd restart
/etc/init.d/mysql restart
/etc/init.d/exim restart
##ANY OTHER COMMANDS CAN GO ABOVE THIS LINE
fi


QUOTE (Notes)
This script will restart apache, mysql, and exim mail server when your privvmpages limit reaches 500MB.

Hope that helps you.

P.S. If you want it to email you, you can add:

echo "Server has reached RAM limit" | mail -s "Ram Limit Reached" email@email.com

under the service restarts.


Keywords: Server memory, VPS resources, RAM



Sponsored Links:

 
> TOPIC: Cron Restart Apache
 

▲ TOP


International Discussions Coded by: BGID®
ALL RIGHTS RESERVED Copyright © 1999-2024
Disclaimer Privacy Report Errors Credits
This site uses Cookies to dispense or record information with regards to your visit. By continuing to use this site you agree to the terms outlined in our Cookies used here: Privacy / Disclaimer,