Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 23, 2019. It is now read-only.

Commit e6ace21

Browse files
Create script for more better way of killing processes on KDE
1 parent 5690430 commit e6ace21

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

‎README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Graceful shutdown
2-
Do graceful shutdown of given programs and wait for them to exit, in doing so, on Linux.
2+
Do graceful shutdown of given programs and wait for them to exit, in doing so, on Linux distribution.
33

4-
Usecase: You don't have to close all programs before logging out or shutdown of your system. Let this script handle it.
5-
on KDE 5, put `graceful-shutdown.sh` in `~/.config/plasma-workspace/shutdown/`. Change `programs_list` variable in `graceful-shutdown.sh` to your usecase.
4+
## Usecase:
5+
You don't have to close all programs before logging out or shutdown of your Linux distribution. Let this script handle it.
6+
You have to look for way to execute this script before your system logs out or shutdowns.
7+
If you use KDE 5 based distributions like KDE Neon (formerly KUbuntu), Manjaro KDE, etc. you use both scripts namely, `graceful-shutdown.sh` and `kde-graceful-shutdown.sh`.
8+
On other systems use only `graceful-shutdown.sh` script. In either case, change `programs_list` variable in `graceful-shutdown.sh` to your usecase.
9+
Make sure both scritps are in `PATH` variable of your **desktop environment shell** or you provide absolute path to them.
10+
11+
### KDE
12+
On KDE 5, put `kde-graceful-shutdown.sh` and `graceful-shutdown.sh` in `~/.config/plasma-workspace/shutdown/`.

‎kde-graceful-shutdown.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
# NOTE! READ THIS COMMENTS BEFORE YOU USE
4+
5+
# Process launched by you from start menu are child of plasmashell
6+
# you don't have to list them in programs_list variable in `graceful-shutdown.sh`.
7+
# Optionally, you can put them there just to be doublely-sure.
8+
9+
if pgrep -fo plasmashell
10+
then
11+
plasmashell_pid=$(pgrep -fo plasmashell)
12+
child_procs=$(pgrep -d ' ' -P $plasmashell_pid)
13+
for c_pid in $(echo $child_procs)
14+
do
15+
pkill --signal SIGTERM $c_pid
16+
done
17+
for c_pid in $(echo $child_procs)
18+
do
19+
while [ -e /proc/$c_pid ]
20+
do
21+
sleep 0.5
22+
done
23+
done
24+
fi

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /