In Natty 11.04, I could specify actions to take when logging out by adding commands to /etc/gdm/PostSession/Default.
But now, in 12.04 (fresh installation, fully updated), the folder /etc/gsm no longer exists.
How do I specify a logout script?
In Natty 11.04, I could specify actions to take when logging out by adding commands to /etc/gdm/PostSession/Default.
But now, in 12.04 (fresh installation, fully updated), the folder /etc/gsm no longer exists.
How do I specify a logout script?
Always make regular backups of your data (and test them).
Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.
Hi Paddy Landau.
Precise is not using gdm anymore. Instead, lightdm is the defualt display manager.
You still will be able to set your login, and logout script, but in a slightly different way. The config file now is:
And the relevant fields are:Code:/etc/lightdm/lightdm.conf
I hope that helps, and tell us how it goes.Code:session-setup-script session-cleanup-script
Regards.
Thank you, papibe.
That does indeed work.
There is a twist, though: the script runs as root and yet ${USER} and ${HOME} are set for the user who is logging in or out.
Therefore, to run a command as the required user, you have to use:
Code:su "${USER}" --command "command-to-run"
Always make regular backups of your data (and test them).
Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.
I am reopening this thread, because the previously-described solution no longer works.
I have tried everything that I can think of (which is not much), but the specified logout script just no longer runs.
So, the question again is:
How do I specify a logout script?
Always make regular backups of your data (and test them).
Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.
There's a quick and probably dirty solution: Add the command to .bash_logout . It's like .profile, but it executes when a user logs out.
Always make regular backups of your data (and test them).
Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.
btw ${PASS} works with spaces nicely:
more TEST.sh
#!/bin/bash
PASS=$*
echo "P: #${PASS}#"
root@my-ubox:/TEST# ./TEST.sh with -d and lots -w of spaces
P: #with -d and lots -w of spaces#
That's all interesting. It is worth trying.
There's something there that I'm not understanding. I'll have to test it thoroughly to understand. If you look at the difference between $*, "$*", $@ and "$@", you will understand my confusion as to how your version manages to work.
Always make regular backups of your data (and test them).
Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.
I'm not getting the same results as you. Here's my test:
Save the following script: testQuotes.bz2
Because of the forum restrictions, it is compressed. Decompress it and ensure that the executable bit is set with: chmod +x testQuotes
The script tests every variation of ${*}, "${*}", ${@}, and "${@}", both from a variable and directly, and calling the receiving script (in this case a function) both with quotes and without (see the script for details).
Now, call the script with the following line (note the multiple spaces within the third parameter):
The receiving script displays what it receives in each test case. What we want is for it to receive three parameters, viz. 'a', 'b c', and ' d e f ' (the latter with multiple spaces included).Code:./testQuotes a 'b c' ' d e f '
However, when you run the script, only the last one works correctly — exactly as predicted by the documentation.
That is why I am confused as to how you are getting correct results from ${PASS}.
Always make regular backups of your data (and test them).
Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.
No need to be confused - I'm not getting the correct results - I'm getting just results "for the umount' command - your syntax is the correct way.
I hope I have attached a file with my scripts and log files, tested and working for multiple users calling $HOME/bin/exit_script.sh upon logout and reboot.
With umount /cdrom and /media/xx etc.still working and not executing the exit_script.sh in each $HOME.
I'm sure there are some syntax flaws within the scripts - this is purely about function.
If you could please confirm if they are doing the job and feel free to provide me the scripts with a correct syntax.
Bookmarks