Wednesday 7 October 2009

Run a script at user login

When a user opens a bash shell, there is a script that runs (~/.bashrc) which configures the shell with the users preferences.

Sometimes you want to run a similar sort of script when a user logs in to the gnome desktop as well.

To do this you need to create a .desktop file and place it in ~/.config/autostart. Here is an example;

[Desktop Entry]
Type=Application
Name=TestScript
Exec=/home/brettg/test.sh
Comment=Testing autostart

You also need to place an executable script (in this case /home/brettg/test.sh) that will hold the commands you want to execute.

More details here and here

No comments: