Commit dfa7f969 authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit some utils

parent c023e821
#!/bin/sh
# See also /etc/sysctl.d/ipcs
# http://help.directadmin.com/item.php?id=572
EMAIL=lav@etersoft.ru
MAX_SEMAPHORES=30
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.
for i in `${IPCS} | grep apache | awk '{print $2}'` ; do
${IPCRM} -s $i
done
serv httpd2 restart
TXT="${COUNT} semaphores cleared for apache for `hostname`"
echo "${TXT}" | ${MAIL} -s "${TXT}" ${EMAIL}
sed -e "s| .*||g" <$1 | sort | uniq -c | sort -n >$1.uniq
tail -n 20 $1.uniq | while read n ip ; do
echo $n $ip $(resolve $ip 2>/dev/null)
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment