c - Delete all shared memory and semaphores on Linux -


how can delete not used semaphores , shared memory single command in ubuntu?

here, save , try script (kill_ipcs.sh) on shell:

#!/bin/bash  me=`whoami`  ipcs_s=`ipcs -s | egrep "0x[0-9a-f]+ [0-9]+" | grep $me | cut -f2 -d" "` ipcs_m=`ipcs -m | egrep "0x[0-9a-f]+ [0-9]+" | grep $me | cut -f2 -d" "` ipcs_q=`ipcs -q | egrep "0x[0-9a-f]+ [0-9]+" | grep $me | cut -f2 -d" "`   id in $ipcs_m;   ipcrm -m $id; done  id in $ipcs_s;   ipcrm -s $id; done  id in $ipcs_q;   ipcrm -q $id; done 

we use whenever run ipcs programs in university student server. people don't cleanup so...it's needed :p


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -