Centos 6 – Script to clean up Shared Memory and Semaphore Arrays (IPCS)

The script below will clean up Shared Memory Segments and Semaphore Arrays. It will first notify you for which under account you are logged under and if you are sure wish to proceed. It will then execute a while loop to clear Shared Memory and Semaphore Arrays. Please note that if an application is brought down in a non clean way it may leave left overs in Shared Memory/Semaphore Arrays.  You need to ensure that the application(s) is down before you execute this script; otherwise shared memory/semaphores will not get cleaned because the application(s) will keep recreating them.

Download Link

http://sfentona.net/ipcs_cleanup.sh

 

 

 

 

 

 

 

 

 

#This script checks for IPCS and cleans the shared memory
#It checks to see if the IPCS cleanup is done for currently logged in user.
#Otherwise it quits.
#Proceed with caution.
clear;
echo “You are currently logged in as user — $USER –“;
echo “Are you sure you want to proceed?”
read ipcs_choice;
if [ “$ipcs_choice” = ‘y’ ] then
ipcs -m | awk ‘{print $2}’ | while read ipcs_proc; do ipcrm -m {$ipcs_proc}; done;
else
exit;
fi
exit;

Share Button

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.