Script to clear semaphore array

Semaphores are for solving multi-threading problems in which multiple processes compete for the same operating system resources.

You can check the semaphore using the following command:

ipcs -s

You can use the below simple script to run manually to clear the semaphore activity; also you can use it to set as cron to clear semaphore in a timely manner.

=========

for i in `ipcs -s | awk ‘{print $2}’`; do ipcrm sem $i; done

=========

 

Leave a Reply

Your email address will not be published. Required fields are marked *