how can i delete all NOT USED semaphores and shared memory with a single command in ubuntu??
I don't know how to delete all at once, but you can use ipcs
to list resources, and then use loop and delete with ipcrm
. This should work, but it needs a little work. I remember that I made it work once in class.
Since you mentioned that you're working on a NFS system, do you have access to those semaphores and shared memory? I think you misunderstood what they are, they are an API code that enables processes to communicate with each other, semaphores are a solution for preventing race conditions and for threads to communicate with each other, in simple answer, they do not leave any residue on any filesystem.
Unless you are using an socket or a pipe? Do you have the necessary permissions to remove them, why are they on an NFS system?
Hope this helps, Best regards, Tom.
ipcs -s | grep $USERNAME | perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'
or
ipcs -s | grep $USERNAME | awk ' { print $2 } ' | xargs ipcrm sem
Change $USERNAME to a real username.