how to run some code on startup

Post test messages here

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
davedobson
 
Posts: 10
Joined: Fri Oct 25, 2013 9:08 pm

how to run some code on startup

Post by davedobson »

Hi folks, I posted this in another forum but still having problems getting it working if you could have a look...
hoping this is a simple question but very much a newbie here. I've been working on the pi satellite radio project found here:
http://learn.adafruit.com/pi-wifi-radio/add-lcd-plate
I have it running perfectly, the only issue is that I am in Canada and need to run a couple lines of script to connect to a proxy. I seem to have to run this every time I start up the pi so I'm hoping I can add it into some kind of startup file? I have tried a couple things but not sure if it's just not working or that there is not enough time to connect to the proxy before loading up the radio login script? ... here is the code I need to run to connect to the proxy:

sudo mv /etc/resolv.conf /etc/resolv.conf.bak
sudo cp resolv.conf.ubuntu /etc/resolv.conf

The next code below is the final bit of code in the project that runs on startup if this helps at all?:

Nearly there! Now we just need to set up the system to start our program upon booting.

sudo nano /etc/rc.local

Before the final “exit 0” line, insert these two lines:

cd /home/pi/Python-WiFi-Radio
python PiPhi.py &

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: how to run some code on startup

Post by adafruit_support_bill »

Hi folks, I posted this in another forum but still having problems getting it working if you could have a look...
This is a test message forum. Please continue this topic in your original thread. I have moved that thread to the Raspberry Pi forum since it is a Pi question, and not an LED question. In the future, you are more likely to get help if you post in the appropriate forums.
http://forums.adafruit.com/viewtopic.ph ... 22#p232421

Locked
Please be positive and constructive with your questions and comments.

Return to “Test Message Forum (closed)”