Created
November 20, 2012 19:44
-
-
Save shang-lin/4120533 to your computer and use it in GitHub Desktop.
Remove a user's IPC shared memory, semaphores, and message queues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# clear_ipc | |
# | |
# Delete the IPC objects created by a user. The user and IPC type are specified on the command | |
# line. | |
# | |
# usage: clear_ipc username type | |
USERNAME=$1 | |
# Type of IPC object. Possible values are: | |
# q -- message queue | |
# m -- shared memory | |
# s -- semaphore | |
TYPE=$2 | |
ipcs -$TYPE | grep $USERNAME | awk ' { print $2 } ' | xargs -I {} ipcrm -$TYPE {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment