Page 1 of 1

Boot to Root and Run a Script?

Posted: Sun Aug 04, 2013 2:36 pm
by trevorjdaniel
Hi,

I have been trying to work out how to

1. Stop my pi booting into LXDE.
2. Boot to a command prompt as root.
3. Run a python script.

I have fallen at the first hurdle. :oops:

I found a posting that says run "sudo raspi-config" and in there is an option to configure whether the pi boots to LXDE - happy days! So, I told it NOT to boot to LXDE. But, now when the pi boots, it automatically runs raspi-config at startup.

I want to boot the pi to a command prompt as root, then run a python script.

Can anyone help please?

Thanks

Trev

Re: Boot to Root and Run a Script?

Posted: Sun Aug 04, 2013 5:03 pm
by itimpi
When it runs raspi-config, just tell rasp-config you are finished. That should stop it running next time.

Re: Boot to Root and Run a Script?

Posted: Sun Aug 04, 2013 6:21 pm
by Joe Schmoe
itimpi wrote:When it runs raspi-config, just tell rasp-config you are finished. That should stop it running next time.
That is certainly good advice, but it begs the question: Why (how) did it get into "auto-run-on-next-boot" mode in the first place? I saw nothing in the OP's description that indicated that it should do that. This makes me wonder if something else is going on - implying that the simple "do it and it will reset itself" advice is maybe not sufficient.

Re: Boot to Root and Run a Script?

Posted: Sun Aug 04, 2013 6:30 pm
by trevorjdaniel
itimpi wrote:When it runs raspi-config, just tell rasp-config you are finished. That should stop it running next time.
it certainly does!!! thanks.

id been just hitting escape as all other settings seemed to save on the fly.

now to crack question 3.

trev

Re: Boot to Root and Run a Script?

Posted: Sun Aug 04, 2013 7:26 pm
by itimpi
If you want something to be run on starting the system put the command into /etc/rc.local. If you want the system continue to a log in prompt then add an & character at the end of the line.

Re: Boot to Root and Run a Script?

Posted: Sun Aug 04, 2013 8:10 pm
by Joe Schmoe
itimpi wrote:If you want something to be run on starting the system put the command into /etc/rc.local. If you want the system continue to a log in prompt then add an & character at the end of the line.
That is one of the many ways to do it - and about the most error-prone, especially for a new user of Unix/Linux.

Basically, there is a 2x2 matrix here - with skill of user on one axis, and whether this is just some odd daemon (like, say, the sshd process), or the main, primary app/usage of the Pi.

In only one of these boxes (high skill, odd daemon) is rc.local a good idea.