หรือสามารถเขียนเป็น shell script ให้รันทุกวัน ได้นะครับเพื่อทำการเครียร์ apache semaphores
cd /etc/cron.daily
vi ipcs_check
#!/bin/sh
[email protected]MAX_SEMAPHORES=15
IPCS=/usr/bin/ipcs
IPCRM=/usr/bin/ipcrm
MAIL=/bin/mail
COUNT=`${IPCS} | grep apache | wc -l`
if [ "$COUNT" -le $MAX_SEMAPHORES ]; then
#all is well, there are no semaphore build-ups.
exit 0;
fi
#we have more than MAX_SEMAPHORES, so clear them out and restart Apache.
LIST=/root/sem.txt
${IPCS} | grep apache | awk '{print $2}' > ${LIST}
for i in `cat ${LIST}`; do
{
${IPCRM} -s $i;
};
done;
/etc/init.d/httpd restart
TXT="${COUNT} semaphores cleared for apache for `hostname`"
echo "${TXT}" | ${MAIL} -s "${TXT}" ${EMAIL}
exit 1;
แล้วทำการปรับสิทธิ์ให้ execute ได้
chmod 755 ipcs_check
./ipcs_check
ถ้าจะไม่ให้ส่งเมลก็ comment
#echo "${TXT}" | ${MAIL} -s "${TXT}" ${EMAIL}
ด้วยนะครับ