On 3/25/11, Patrick Dupre <patrick.dupre at york.ac.uk> wrote: > Hello, > > When I leave the X session, how can I execute a shell command ? If you start it with startx, as the subject seems to suggest, then you could do startx ; your_shell_command or startx && your_shell_command and then your shell command will not be executed if startx failed. HTH Andras