Created
September 1, 2010 19:05
-
-
Save tjstein/561172 to your computer and use it in GitHub Desktop.
Find out what Apache MaxClients should be set to
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" | |
elif [ -e /etc/redhat-release ]; then | |
APACHE="httpd" | |
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" | |
/etc/init.d/$APACHE stop &> /dev/null | |
MEM=`free -m |head -n 2 |tail -n 1 |awk '{free=($4); print free}'` | |
echo "Starting $APACHE again" | |
/etc/init.d/$APACHE 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