Page 1 of 1
execute apps or script after Password entry
Posted: Mon Dec 01, 2014 10:26 pm
by pcote_pi
Allo,
I have been searching this topic without success and many failed trials.
I boot raspbian in the terminal mode to be able to enter the username and password. After I enter the password I would like "startx" or any other apps or script to start automatically instead of getting the terminal prompt.
Is there any tutorial ti understand the boot sequence? Where is it located? How does it starts and end?
Thanks
Patrice
Re: execute apps or script after Password entry
Posted: Mon Dec 01, 2014 10:29 pm
by DougieLawson
If you want startx without a userid/password you can auto login the pi user and start the desktop. That's an option in sudo raspi-config.
Re: execute apps or script after Password entry
Posted: Mon Dec 01, 2014 10:35 pm
by pcote_pi
I still want to enter the username and password but after these steps, I would like startx or any executable to start right away automatically.
Re: execute apps or script after Password entry
Posted: Mon Dec 01, 2014 10:39 pm
by DougieLawson
To do that one way is to add it to your ~/.profile or ~/.bashrc but watch out that you may find those scripts get run whenever you open an LXTerminal on the GUI. You may need to do some special processing to avoid starting a task that's already running.
http://superuser.com/questions/49289/wh ... ashrc-file
Re: execute apps or script after Password entry
Posted: Mon Dec 01, 2014 10:43 pm
by pcote_pi
OK I'll take a look. I thought that if I could find the right autorun file I could replace the execution of the lx terminal by the execution of startx instead.
Feasible?
Re: execute apps or script after Password entry
Posted: Tue Dec 02, 2014 9:27 am
by rpdom
DougieLawson wrote:You may need to do some special processing to avoid starting a task that's already running.
The very basic check would be
Code: Select all
if [ "$DISPLAY" = "" ]
then
if ! pidof -s lxsession >/dev/null
then
exec startx
fi
fi
But that only checks to see if you are in a console loginI, then checks to see if a GUI is already running.
(Not tested as I have no Pis with GUIs. I'm assuming lxsession is running for the desktop, other wise see what's there with ps -e)