igreenius
Posts: 11
Joined: Wed Aug 19, 2015 7:26 am

Launch Script upon Login. (pi user only)

Tue Sep 08, 2015 10:54 am

Greetings!
I successfully joined my Raspberry on a domain by following a post here.
Now, I want to run a script on startup but on 'pi' user account only.

I did this before using this method:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
added this before the screensaver line:
@lxterminal --command "python /home/pi/myScript.py"

...but the problem is - the script is launching also upon logging in the domain account.

TIA.

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Launch Script upon Login. (pi user only)

Tue Sep 08, 2015 11:49 am

Put it in the individual users autostart file.

/home/pi/.config/lxsession/LXDE/autostart

If the autostart file doesn't exist you can create it.

igreenius
Posts: 11
Joined: Wed Aug 19, 2015 7:26 am

Re: Launch Script upon Login. (pi user only)

Tue Sep 08, 2015 11:54 am

@JimmyN, thanks for the response. Unfortunately, lxsession folder also doesn't exists. Will it work if I manually create it?

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Launch Script upon Login. (pi user only)

Tue Sep 08, 2015 2:48 pm

Yes, it doesn't exist by default, just create it.

igreenius
Posts: 11
Joined: Wed Aug 19, 2015 7:26 am

Re: Launch Script upon Login. (pi user only)

Wed Sep 09, 2015 3:46 am

Thanks JimmyN - appreciate your help here. ^___^

At first it did not work so I replace "LXDE" folder with "LXDE-pi".
I remembered I encountered this before on my first method so I figured that I need to rename the folder.

P.S. I don't know why it is working with "LXDE-pi"

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Launch Script upon Login. (pi user only)

Wed Sep 09, 2015 10:31 am

It used to be LXDE, now it uses LXDE-pi if you're running a newer version. The RPi here on my desk is

Code: Select all

Linux rpi 4.1.6+ #810 PREEMPT Tue Aug 18 15:19:58 BST 2015 armv6l
and it still uses LXDE.

Return to “Beginners”