I want to run a script when I log out through unity. I read something about lightdm but I don't really know what it is and the config file didn't exist. The config file mentioned here doesn't exist! And manualy creating it doesn't solve my problem.


1 Answer 1

  1. Open terminal ( or also known as command line ) by pressing together CtrlAltT or by finding it in dash.

  2. Run this command sudo gedit /etc/lightdm/lightdm.conf. This opens text editor with lightdm.conf file located in /etc/lightdm folder.

  3. In the file you should have this line [SeatDefaults] . Bellow this line , enter session-cleanup-script=/path/to/your-script.sh , where /path/to/your-script.sh is the actuall address of the script that you want to run. Note: make sure your script is set to executable by running sudo chmod +x /path/to/script.sh

  4. Save and exit

NOTE: as of 14.04 version, the config file doesn't exist and must be created manually OR copied from an example file using the following command

 sudo sh -c ' zcat /usr/share/doc/lightdm/lightdm.conf.gz > /etc/lightdm/lightdm.conf`
  • Thank you for replying but this config file doesn't exist.
    – Marton
    Commented May 16, 2015 at 16:53
  • The solution here worked but the config file was not located in /etc/lightdm/lightdm.conf but in /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf.
    – Marton
    Commented May 16, 2015 at 18:13
  • 1
    In case the config file does not exist, I think you should just create it in this location. Don't forget to add the headline [SeatDefaults] as well then.
    – Byte Commander
    Commented Mar 17, 2016 at 15:46
  • I've addressed the existence of the file issue Commented Mar 18, 2016 at 13:49

Not the answer you're looking for? Browse other questions tagged .