The links point to the Purdue Online Writing Lab.
(updated links: 22 Mar 2019)
When the system is not down
#!/bin/bash
#email jachermocilla@gmail.com
echo -n "Enter percent of free memory to use for Apache(1-100): "
read PERCENT_OF_FREE_FOR_APACHE
#restart apache
service apache2 restart > /dev/null
#PERCENT_FREE_FOR_APACHE=75
echo "Percent of free memory to allocate to apache(%): $PERCENT_OF_FREE_FOR_APACHE"
#MEM_TOTAL=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
#echo "Total system memory (kB): $MEM_TOTAL"
MEM_SINGLE_APACHE=`ps -o pid -C apache2 | tail -1 | xargs pmap -x | grep total | awk '{print $4}'`
echo "Estimated memory used by a single Apache process (kB): $MEM_SINGLE_APACHE"
echo "Estimating free memory without Apache..please wait"
service apache2 stop > /dev/null
sleep 20
MEM_FREE_NO_APACHE=`free | grep buffers/cache | awk '{print $4'}`
service apache2 start > /dev/null
echo "Free memory without Apache: $MEM_FREE_NO_APACHE"
MEM_FREE_FOR_APACHE=`echo "scale=2;($PERCENT_OF_FREE_FOR_APACHE/100.0)*$MEM_FREE_NO_APACHE" | bc`
echo "Estimated free memory usable by Apache (kB): $MEM_FREE_FOR_APACHE"
#some constants
MAGIC=2.5
MAX_CLIENTS=`echo "scale=0;($MEM_FREE_FOR_APACHE/($MEM_SINGLE_APACHE))*$MAGIC" | bc`
echo "Recommended MaxClients/MaxRequestWorkers: $MAX_CLIENTS"
file winxp.qcow2
qemu-img resize winxp.qcow2 +10GB
qemu-system-i386 -hda winxp.qcow2 -cdrom gparted-live.iso -boot d
remove_unused_base_images = False