In Ubuntu 12.04 I used LightDM config parameter session-cleanup-script
to run a script when a user logs out.
In Ubuntu 16.04 this script is also fired when a user types the wrong username or password. So the user wasn't even logged in.
How can I run a script in Ubuntu 16.04 only if a user logs out?
EDIT:
OK, I thought this is an easy one. But it seems to be more complex. I use this on public terminal PCs. At first LightDM is not loaded. The user has to choose between Windows (via VMware View), Ubuntu and a Kiosk browser. He clicks a specific button to login to Ubuntu. Now LightDM (and some other stuff) gets started. When the user logs out LightDM gets stopped from the script in session-cleanup-script
.
I think the Upstart/systemd method wont work as I need some environment variables like $USER
and $HOME
, right?.
The DBus signal seems to fire when the user wants to logout. I need a event when the user already is logged out to clean some things.
I need a event when the user already is logged out
, well put a delay withsleep
, or fire up a script that will keep looking at output ofwho
command to see when username disappears form the list of logged in users. – Sergiy Kolodyazhnyy Nov 16 '16 at 07:40