summaryrefslogtreecommitdiffstats
path: root/scripts/tdekillall
diff options
context:
space:
mode:
authorDarrell Anderson <humanreadable@yahoo.com>2014-01-06 03:01:39 +0100
committerSlávek Banko <slavek.banko@axis.cz>2014-01-06 03:01:39 +0100
commit898c379f4cf6ac2fac13135103d682bbef48f798 (patch)
treecc3aadcd0204c3efb68ae92851ada1090f869ebb /scripts/tdekillall
parent238786bbd9c90a2297da9c7a3badad019ff44590 (diff)
downloadtdesdk-898c379f4cf6ac2fac13135103d682bbef48f798.tar.gz
tdesdk-898c379f4cf6ac2fac13135103d682bbef48f798.zip
Rename kdekillall -> tdekillall
Diffstat (limited to 'scripts/tdekillall')
-rwxr-xr-xscripts/tdekillall28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/tdekillall b/scripts/tdekillall
new file mode 100755
index 00000000..ddf450de
--- /dev/null
+++ b/scripts/tdekillall
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+case $1 in
+ -*) signal=$1; shift;;
+esac
+if [ $# = 0 ]; then
+ echo "Usage: $0 [-<signal>] <process>"
+ echo 'Kills the process "tdeinit: <process> with signal <signal>"'
+ echo "if <signal> is not specified, it defaults to SIGTERM,"
+ echo "see kill -l for a list of possible SIGNALS"
+else
+ list=$(ps auwx | grep $USER | awk "/[k]deinit: $1/ {print \$2}")
+ if test -z "$list"; then
+ # on newer Linux kernels (>= 2.6.10) KDE is able to use
+ # prctl(PR_SET_NAME) to change the process name...
+ list=$(ps auwx | grep $USER | awk "/\[tdeinit\] $1/ {print \$2}")
+ fi
+ if test -z "$list"; then
+ # with KDE 3.4 we changed the view again...
+ list=$(ps auwx | grep $USER | awk "/$1 \[tdeinit\]/ {print \$2}")
+ fi
+ if test -n "$list"; then
+ kill $signal $list
+ else
+ echo 'No process killed'
+ exit 1
+ fi
+fi