Created
November 16, 2011 18:34
-
-
Save ecoleman/1370915 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "This is intended as a guideline only!" | |
if [ -e /etc/debian_version ]; then | |
APACHE="apache2" | |
RC_COMMAND="/etc/init.d/$APACHE" | |
elif [ -e /etc/redhat-release ]; then | |
APACHE="httpd" | |
RC_COMMAND="/etc/init.d/$APACHE" | |
elif [ -e /etc/arch-release ]; then | |
APACHE="httpd" | |
RC_COMMAND="/etc/rc.d/$APACHE" | |
fi | |
RSS=`ps -aylC $APACHE |grep "$APACHE" |awk '{print $8'} |sort -n |tail -n 1` | |
RSS=`expr $RSS / 1024` | |
echo "Stopping $APACHE to calculate free memory" | |
$RC_COMMAND stop &> /dev/null | |
MEM=`free -m |head -n 2 |tail -n 1 |awk '{free=($4); print free}'` | |
echo "Starting $APACHE again" | |
$RC_COMMAND start &> /dev/null | |
echo "MaxClients should be around" `expr $MEM / $RSS` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment