You are not logged in.
I set the bash script to autoload using the shortcut /home/localuser/.config/autostart/script.desktop
This script runs in the background ( some commands with "&" ).
When the user logs out, the script does not exit.
Instead of the parent xfce4-session, the parent of the script becomes /sbin/init
Is there a way to terminate the script when the user logs out?
OS Debian 11
xfce 4.16
P.S. It seems that when the user logs out, no signals are passed to the script
I used test.desktop shortcut for tests:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=/home/localuser/.config/autostart/test.sh
Terminal=false
Hidden=false
NoDisplay=true
Name=Signal monitoring
and script:
#!/bin/bash
sleep 10000 &
SLEEP_PID=$!
for SIGNAL in {1..64}; do
trap "echo \$(date --rfc-3339=ns) signal $SIGNAL >> /home/localuser/.config/autostart/test.log" $SIGNAL
done
trap 'kill $(jobs -p)' EXIT
wait $SLEEP_PID;
Last edited by evg (2022-11-12 19:37:26)
Offline
Hello and welcome.
There is an open bug report for this. As a workaround, you could set "KillUserProcesses=yes" in /etc/systemd/logind.conf - however note that this will kill all session processes including screen & tmux (if you use those).
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Hello!
Thanks for the quick response.
As an idea for development: In the future, it would be nice if xfce could distinguish
between applications to be terminated and applications to be left running.
For example, for *.desktop shortcuts, add the RemineRunningAfterLogout or KillAfterLogout key.
And for applications launched by the user, xfce would ask when exiting - which applications should be left running, and which should be forcibly terminated.
Of course, everything is optional.
Xfce good system, I wish it further development and all the best
Offline
[ Generated in 0.008 seconds, 7 queries executed - Memory usage: 523.27 KiB (Peak: 524.15 KiB) ]