Collect only intended PIDs to wait for

This commit is contained in:
exu 2023-11-10 14:15:02 +01:00
parent a9db7932ab
commit 95baa58f66

View File

@ -103,6 +103,9 @@ cat <<EOF
######################################## ########################################
EOF EOF
# Collect all PIDs of background processes that shoulb be waited for
pids=""
#################### ####################
##### Cleaning ##### ##### Cleaning #####
#################### ####################
@ -374,8 +377,13 @@ EOF
imagepath="/home/marc/Bilder/Backgrounds/artstation/dk-lan/artstation_14224733_55806391_月半与鬼哭.jpg" imagepath="/home/marc/Bilder/Backgrounds/artstation/dk-lan/artstation_14224733_55806391_月半与鬼哭.jpg"
if [ -f "$imagepath" ]; then if [ -f "$imagepath" ]; then
betterlockscreen -u "$imagepath" & betterlockscreen -u "$imagepath" &
pids="$pids $!"
fi fi
echo $pids
jobs
jobs -p
# reload systemd user scripts # reload systemd user scripts
systemctl --user daemon-reload systemctl --user daemon-reload
@ -517,6 +525,12 @@ if ps aux | grep -E "\si3(\s|$)" &>/dev/null; then
i3-msg restart 1>/dev/null i3-msg restart 1>/dev/null
fi fi
jobs
jobs -p
# wait for all background jobs to finish
wait $pids && echo "Finished background jobs"
echo echo
cat <<EOF cat <<EOF
######################################## ########################################
@ -538,12 +552,6 @@ if [[ $(pacman -Q | grep podman) ]]; then
echo -e "\033[38;2;200;20;20mRemember to set \"amdgpu.ppfeaturemask=0xffffffff\" in the kernel!!\033[0m" echo -e "\033[38;2;200;20;20mRemember to set \"amdgpu.ppfeaturemask=0xffffffff\" in the kernel!!\033[0m"
fi fi
jobs
jobs -p
# wait for all background jobs to finish
wait $(jobs -p) && echo "Finished background jobs"
# reload user default shell # reload user default shell
exec "$(getent passwd $LOGNAME | cut -d: -f7)" exec "$(getent passwd $LOGNAME | cut -d: -f7)"