pcote_pi
Posts: 38
Joined: Mon Nov 03, 2014 12:29 am
Location: Montréal

execute apps or script after Password entry

Mon Dec 01, 2014 10:26 pm

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

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: execute apps or script after Password entry

Mon Dec 01, 2014 10:29 pm

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.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

pcote_pi
Posts: 38
Joined: Mon Nov 03, 2014 12:29 am
Location: Montréal

Re: execute apps or script after Password entry

Mon Dec 01, 2014 10:35 pm

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.

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: execute apps or script after Password entry

Mon Dec 01, 2014 10:39 pm

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
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

pcote_pi
Posts: 38
Joined: Mon Nov 03, 2014 12:29 am
Location: Montréal

Re: execute apps or script after Password entry

Mon Dec 01, 2014 10:43 pm

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?

User avatar
rpdom
Posts: 17174
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: execute apps or script after Password entry

Tue Dec 02, 2014 9:27 am

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)

Return to “Beginners”