#!/bin/sh

if [ "X$ARB_PID" = "X" ] ; then
	pidfiles=/tmp/arb_pids_$USER_*
	if [ "X$pidfiles" = "X" ]; then
		exit 0;
	fi
else
	pidfiles=/tmp/arb_pids_${USER}_${ARB_PID}
fi

# Make sure files to remove are no symbolic links
if  [ "\"X$pidfiles\"" != "X" -a -f "$pidfiles" ];  then
	kill -9 `cat $pidfiles` >/dev/null 2>&1
	rm -f $pidfiles
fi

for pidfile in /tmp/arb_*_${USER}_${ARB_PID}* ; do
	if [ -f "$pidfile" ] ; then
		rm -f "$pidfile"
	fi
done
