File: arb-kill

package info (click to toggle)
arb 6.0.6-8
  • links: PTS, VCS
  • area: non-free
  • in suites: sid, trixie
  • size: 66,204 kB
  • sloc: ansic: 394,911; cpp: 250,290; makefile: 19,644; sh: 15,879; perl: 10,473; fortran: 6,019; ruby: 683; xml: 503; python: 53; awk: 32
file content (26 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (6)
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