How to: Run a command on start / boot up on Raspberry Pi Wheezy (Autostart)

I recently had the problem that my OpenVPN tunnel did not assigned to an IP address. Since i was not in a mood to find out what causes the problem i simply wrote a bash script that runs “dhclient tap0” after booting up the system.

for example, “sudo nano /home/pi/myautoip.sh” :

printf “Trying to get an IP address for tap0”
dhclient tap0

In order to achieve that this command is executed we have to add a command to /etc/rc.local.
so “sudo nano /etc/rc.local”. Add this ABOVE the “exit 0”:

bash /home/pi/myautoip.sh

Advertisements

Posted on January 13, 2014, in Uncategorized and tagged , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: