Hello,
I spent quite some time on this and found a lot of stuff on the internet but nothing worked with Debian 11 / Mate so far.
What I need is to run a script when the user logs out. Similar to the "Control Center" -> "Startup Applications" but not at login but at logoff time. How do I do that?
And I do need it for user session logout and not system shutdown. I have that part covered easily with a systemd entry.
Kind Regards,
Hugo
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Debian 11 mate user logout script [SOLVED]
Re: Debian 11 mate user logout script
I have used a shutdown/reboot/logout script on debian 11. It checkes if a vm is running. You can shutdown if there are no vm's running.
The script uses kdialog.
Perhaps this gives you a starting point.
The script uses kdialog.
Code: Select all
#!/bin/bash
# check if VM's are running
# shutdown only if there are no VM's running
# vmCount is number of running vm's
vmCount=$(pgrep -c qemu-system-x86)
if [ $vmCount -gt 0 ] # VM's are running
then
vmText="Unable to Shutdown/Reboot!\n\nVM's must be closed before Shutdown/Reboot/Logout."
kdialog --title "Shutdown" --msgbox "$vmText"
exit # no shutdown
fi
#shutdown
var=$(/usr/bin/kdialog --geometry 275x185+850+500 --radiolist "Shutdown/Reboot/Logout" 1 "\
Shutdown" on 2 " Reboot" off 3 " Logout" off)
varButton=$?
case $var in
1)
systemctl poweroff
;;
2)
systemctl reboot
;;
3)
userName=$(whoami)
echo $userName
pkill -KILL -u $userName
;;
esac
Re: Debian 11 mate user logout script
Hi Peer,
thank you for your reply but I am not looking for a script, I am looking for a place to start my script when a user logs out (so not system shutdown).
I was using Centos and Gnome 2 before it was rendered unusable with version 3 and then Mate which was basically identical. I was using /etc/gdm/PostSession/Default for that purpose. But now after changing to Debian with Mate this script does not exist anymore (why do people keep changing things all the time? Do they have any idea how much of the users time they are wasting?) .
Would you know where to look? Even with the GUI interface for "Start applications" I could not figure out where this application start is happening (this mechanism reminds me a bit of windows; never used GUIs for that reason). Any ideas?
Kind Regards,
Hugo
thank you for your reply but I am not looking for a script, I am looking for a place to start my script when a user logs out (so not system shutdown).
I was using Centos and Gnome 2 before it was rendered unusable with version 3 and then Mate which was basically identical. I was using /etc/gdm/PostSession/Default for that purpose. But now after changing to Debian with Mate this script does not exist anymore (why do people keep changing things all the time? Do they have any idea how much of the users time they are wasting?) .
Would you know where to look? Even with the GUI interface for "Start applications" I could not figure out where this application start is happening (this mechanism reminds me a bit of windows; never used GUIs for that reason). Any ideas?
Kind Regards,
Hugo
Re: Debian 11 mate user logout script
Hello,
I found the solution here: https://ubuntuforums.org/showthread.php?t=1918649
You have to edit the /etc/lightdm/lightdm.conf file, setting 'session-cleanup-script' can be set to any script you want to run when the user logs out. Works also when you do not shut down the system.
Kind Regards,
Hugo
.
I found the solution here: https://ubuntuforums.org/showthread.php?t=1918649
You have to edit the /etc/lightdm/lightdm.conf file, setting 'session-cleanup-script' can be set to any script you want to run when the user logs out. Works also when you do not shut down the system.
Kind Regards,
Hugo
.