#!/bin/sh

IPCS=ipcs
# $IPCS | egrep '^m .*|^s .*' | egrep "`whoami`|postgres|picasso" | \
# awk '{printf "ipcrm -%s %s\n", $1, $2}' '-' > /tmp/ipcclean.$$

$IPCS -m | egrep '^[0-9].*'"`whoami`|postgres|picasso" | \
awk '{printf "ipcrm shm %s\n", $1}' > /tmp/ipcclean.$$

$IPCS -s | egrep '^[0-9].*'"`whoami`|postgres|picasso" | \
awk '{printf "ipcrm sem %s\n", $1}' >> /tmp/ipcclean.$$


chmod +x /tmp/ipcclean.$$
if (test -s /tmp/ipcclean.$$)
then
	/tmp/ipcclean.$$
fi
rm -f /tmp/ipcclean.$$
