Last active
July 25, 2016 11:59
-
-
Save RPDiep/55577709630d4a0bc29a88f80ab36ff4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
max_apache_semaphores=20 | |
cur_apache_semaphores=$(ipcs -s | grep -c apache) | |
apachectl=$(which apache2ctl apachectl 2>/dev/null) | |
[[ ${cur_apache_semaphores} -ge ${max_apache_semaphores} ]] && { | |
logger -t $(basename $0) "Cleaning up semaphores for apache" | |
ipcs -s | awk '/apache/ {print $2}' | xargs -n1 ipcrm -s | |
${apachectl} restart | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add as script in /etc/cron.hourly and
chmod +x
the script