共享内存清理
ipcs 命令格式
***************
ipcs -h
ipcs provides information on ipc facilities for which you have read access.
Resource Specification:
-m : shared_mem
-q : messages
-s : semaphores
-a : all (default)
Output Format:
-t : time
-p : pid
-c : creator
-l : limits
-u : summary
-i id [-s -q -m] : details on resource identified by id
usage : ipcs -asmq -tclup
ipcs [-s -m -q] -i id
ipcs -h for help.
***************
ipcrm 命令格式
usage: ipcrm [ [-q msqid] [-m shmid] [-s semid]
[-Q msgkey] [-M shmkey] [-S semkey] ... ]
***************脚本如下***************
#!/bin/sh
#清理共享内存
SHM_IDSUM=`ipcs -m | awk '{if ( $1 ~ /0x50002/ ) print $1}'`
for SHM_ID in $SHM_IDSUM; do
echo "ipcrm -M $SHM_ID"
ipcrm -M $SHM_ID
done
#清理 sem
SEM_IDSUM=`ipcs -s | awk '{if ( $1, /0x50002/ ) print $1}'`
for SEM_ID in $SEM_IDSUM; do
echo "ipcrm -S $SEM_ID"
ipcrm -S $SEM_ID
done
阅读(1319) | 评论(0) | 转发(0) |