1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#!/bin/sh
arb_clean
if [ _"$1" != _"--all" ] ; then
# grep only the processes owned by $USER
kill -9 `ps aux | grep -w "^${USER}" | grep -v "0:0[0-9] grep " | grep -v "0:0[0-9] ps " | \
grep -w -e arb -e arb_ntree | \
grep -v nxagent | \
sed "s/^${USER}[[:space:]]\+\([0-9]\+\)[[:space:]]\+.*/\1/"`
for arbpid in /tmp/arb_pids_${USER}_* ; do
if [ -f "$arbpid" ] ; then
rm -f "$arbpid"
fi
done
else
# # if option --all was given kill all processes trying sudo
sudo kill -9 `ps aux | grep -v "0:0[0-9] grep " | grep -v "0:0[0-9] ps " | \
grep -w -e arb -e arb_ntree | \
grep -v nxagent | \
sed "s/^[a-z0-9]\+[[:space:]]\+\([0-9]\+\)[[:space:]]\+.*/\1/"`
for arbpid in /tmp/arb_pids_*_* ; do
if [ -f "$arbpid" ] ; then
rm -f "$arbpid"
fi
done
fi
|