| Server IP : 104.21.95.231 / Your IP : 104.23.243.226 Web Server : Apache System : Linux vm3310.eosdns.net 4.18.0-553.132.1.el8_10.x86_64 #1 SMP Thu Jun 11 14:27:43 UTC 2026 x86_64 User : carnalmedia ( 1000) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /mojo/ |
Upload File : |
#!/bin/bash
#
# Script: clear_semaphores
#
# Usage: clear_semaphores now
#
# Description: A tool for clearing abandoned Apache semaphores
#
# Author: Adam Gomulka
#
# Changelog:
# * 06/26/2014: Adam Gomulka
# - Initial write
# * 10/20/2014: Adam Gomulka
# - Added full paths to binaries
# * 19.01.2021: Nikita Shchetinin
# - Simplified and updated following recommendations from Red Hat documentation
if [ "$(whoami)" != 'root' ]
then
echo "You must execute this script as the root user!"
exit 1
fi
CLEARSEM () {
if [ $(pgrep ^httpd$ | wc -l) -eq 0 ]
then
if [ $(/bin/ipcs -s | grep apache | awk '{print$2}' | wc -l) -eq 0 ]
then
echo "No abandoned Apache semaphores found"
else
/bin/ipcrm sem $(/bin/ipcs -s | grep apache | awk '{print$2}')
fi
else
echo "Make sure that Apache is not running"
fi
}
HELP () {
echo "A tool for clearing abandoned Apache semaphores"
echo "usage: clear_semaphores now"
}
if [ "$1" == "now" ]
then
CLEARSEM
else
HELP
fi