Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Which would be the best way to run a script upon GUI logoff, shutdown, hibernate, sleep modes? In 12.04 I think I did this in /etc/lightdm/lightdm.conf, but on 13.10, the folder structure changed and when I create this script, The display manager wont even start upon boot.

I am looking to implement a simple automatic truecrypt unmount command

truecrypt -d

but of course this would go for any script.

Edit: The file doesn't exist, and if I create it and just put the lines

session-cleanup-script = /path/to/executable/script.sh

, After reboot I can't log in anymore until I delete the file anymore. This also happens if The File starts with

[SeatDefaults] 
session-cleanup-script = ... 

How come this is not working at all, and/or why the file doesnt exist in the first place? thanks

share|improve this question

1 Answer 1

up vote 1 down vote accepted

That file, /etc/lightdm/lightdm.conf, should look like:

[SeatDefaults]
session-cleanup-script=/path/to/executable/script.sh

Try also in terminal to see what is happening when you assign a value to a variable like this: a = b and when you assign a value to a variable like this: a=b. First variant will give you all the time a command not found error. So, please, don't put spaces around the = in assignments!

share|improve this answer
    
Ok, thanks, that worked. Apart from the space in the assignment, the main problem in the end was that I got over-eager and added a session-setup-script at the same time, which contained a non-accepted command (truecrypt scripted mount), and then I couldnt even log in with the lightdm.conf in place. Am I right to assume that reboot and shutdown also log out the user? –  TNT Nov 13 '13 at 7:58
    
A normal (not forced) reboot/shutdown, yes, imply a successful log out of all currently logged users. –  Radu Rădeanu Nov 13 '13 at 8:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.