Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start shell script after lightdm is being logged in

I have Debian OS, and I want to start shell script after lightdm is being logged in, how can I do that?

I tried to put

session-setup-script=/path/to/my/script in /etc/lightdm/lightdm.conf

file, but It won't work.

Any advice?

like image 798
Junior Avatar asked Sep 20 '25 15:09

Junior


2 Answers

Try invoking your script in an ~/.xsession file.

This file is executed upon X server startup. More info here: https://unix.stackexchange.com/questions/47359/what-is-xsession-for

like image 112
neric Avatar answered Sep 22 '25 08:09

neric


I was having the same issue and realised that I had set the option at the wrong point in /etc/lightdm/lightdm.conf, a silly mistake.

The seat defaults are documented before the [SeatDefaults] heading and I was placing my setting on the line below the documentation.

so

# session-setup-script = Script to run when starting a user session (runs as root)
session-setup-script=/usr/bin/bla

Looking further down the file I found the heading [SeatDefaults] and below that the setting.

#session-setup-script=

Un-commenting that line and setting the script worked as expected.

like image 41
PiersyP Avatar answered Sep 22 '25 09:09

PiersyP