The ipcs command can be used to obtain the status of all System V IPC objects.
ipcs -q: Show only message queues
ipcs -s: Show only semaphores
ipcs -m: Show only shared memory
ipcs –help: Additional arguments
By default, all three categories of objects are shown. Consider the following sample output of ipcs:
—— Shared Memory Segments ——– shmid owner perms bytes nattch status
—— Semaphore Arrays ——– semid owner perms nsems status
—— Message Queues ——– msqid owner perms used-bytes messages 0 root 660 5 1
Here we see a single message queue which has an identifier of ``0''. It is owned by the user root, and has octal permissions of 660, or -rw-rw–. There is one message in the queue, and that message has a total size of 5 bytes.
The ipcs command is a very powerful tool which provides a peek into the kernel's storage mechanisms for IPC objects. Learn it, use it, revere it.
To remove objects below are the commands:
for i in `ipcs -m | grep zabbix | awk '{print $2}'`; do ipcrm -m $i; done → Shared Memory Segments
for i in `ipcs -s | grep zabbix | awk '{print $2}'`; do ipcrm -s $i; done → Semaphore Arrays
for i in `ipcs -q | grep zabbix | awk '{print $2}'`; do ipcrm -q $i; done → Message Queues
For Eg:
for i in `ipcs -m | grep zabbix | awk '{print $2}'`; do ipcrm -m $i; done
for i in `ipcs -s | grep zabbix | awk '{print $2}'`; do ipcrm -s $i; done
for i in `ipcs -q | grep zabbix | awk '{print $2}'`; do ipcrm -q $i; done
No comments:
Post a Comment