Mini Shell
Direktori : /opt/sharedrads/ |
|
Current File : //opt/sharedrads/temp_apache_fix |
mem=$(ps -o 'rss' -C httpd|awk '{sum += $1} END {print sum/1024/1024}' |tail -1);
memint=${mem%.*}
echo "Apache is using $mem G of memory right now";
count=$(apachectl fullstatus | awk '$4 ~ /G/' | awk '{print $14}' | wc -l);
echo "Currently have $count gracefully stopping Apache processes";
echo "Looking for FPM pools to restart...";
apachectl fullstatus | awk '$4 ~ /G/' | awk '{print $14}' | sort | uniq -c | sort -nk1 | tail -4 | awk '{print $2}' | awk -F: '{print $1}' | while read dom; do conf=$(grep "^\[.*$dom" -rl /opt/ngxconf); if [ ! -z $conf ]; then master=$(basename -s.conf $conf); echo $master; fi; done | sort | uniq | while read master; do echo "Restarting $master..."; /opt/imh-python/bin/supervisorctl -c /opt/ngxconf/supervisord/supervisord.conf restart $master; done
count=$(apachectl fullstatus | awk '$4 ~ /G/' | awk '{print $14}' | wc -l);
echo "We now have $count gracefully stopping Apache processes";
echo "Waiting a bit to let Apache reclaim workers...";
sleep 10;
mem=$(ps -o 'rss' -C httpd|awk '{sum += $1} END {print sum/1024/1024}' |tail -1);
echo "Apache is using $mem G of memory now. If it's significantly less, we should be good!";
Zerion Mini Shell 1.0