mirror of
https://github.com/dockur/windows.git
synced 2025-12-16 20:23:04 +00:00
refactor: replace duplicated PID cleanup with loop
This commit is contained in:
parent
ad6f87046a
commit
c274358ff1
25
src/power.sh
25
src/power.sh
@ -76,6 +76,12 @@ finish() {
|
|||||||
local pid
|
local pid
|
||||||
local cnt=0
|
local cnt=0
|
||||||
local reason=$1
|
local reason=$1
|
||||||
|
local pids=(
|
||||||
|
"/var/run/tpm.pid"
|
||||||
|
"/var/run/wsdd.pid"
|
||||||
|
"/var/run/samba/nmbd.pid"
|
||||||
|
"/var/run/samba/smbd.pid"
|
||||||
|
)
|
||||||
|
|
||||||
touch "$QEMU_END"
|
touch "$QEMU_END"
|
||||||
|
|
||||||
@ -114,21 +120,12 @@ finish() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pid="/var/run/tpm.pid"
|
for pid in "${pids[@]}"; do
|
||||||
[ -s "$pid" ] && pKill "$(<"$pid")"
|
if [[ -s "$pid" ]]; then
|
||||||
rm -f "$pid"
|
pKill "$(cat "$pid")"
|
||||||
|
fi
|
||||||
pid="/var/run/wsdd.pid"
|
|
||||||
[ -s "$pid" ] && pKill "$(<"$pid")"
|
|
||||||
rm -f "$pid"
|
|
||||||
|
|
||||||
pid="/var/run/samba/nmbd.pid"
|
|
||||||
[ -s "$pid" ] && pKill "$(<"$pid")"
|
|
||||||
rm -f "$pid"
|
|
||||||
|
|
||||||
pid="/var/run/samba/smbd.pid"
|
|
||||||
[ -s "$pid" ] && pKill "$(<"$pid")"
|
|
||||||
rm -f "$pid"
|
rm -f "$pid"
|
||||||
|
done
|
||||||
|
|
||||||
closeNetwork
|
closeNetwork
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user