File: codelite_kill_children

package info (click to toggle)
codelite 6.1.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 48,992 kB
  • ctags: 43,502
  • sloc: cpp: 334,263; ansic: 18,441; xml: 4,713; yacc: 2,653; lex: 2,449; python: 1,188; sh: 385; makefile: 40
file content (17 lines) | stat: -rwxr-xr-x 410 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

## let the user pass an option if e.g. -9 for "hard kills"

sig_options=$2
osname=$(uname -o)

if [ "$osname" = "FreeBSD" ]; then
    procs=`ps -A -o ppid,pid | sed -e '1d' | awk '{print $1" "$2}' | grep "^$1 " | awk '{print $2}' | xargs`
else
    procs=`ps --ppid $1 | grep -v PID | awk '{print $1;}'`
fi
for p in $procs
do
	kill $sig_options $p 2> /dev/null
done
kill $sig_options $1 2> /dev/null