0

Situation: Whenever I boot up my Raspberry PI, I have to enter a few lines of commands to enable an interface. The commands:

sudo modprobe batman-adv
sudo batctl if add wlan0
sudo ifconfig wlan0 up
sudo ifconfig bat0 up

I would like to run a script that allows these commands to execute automatically when I boot up the Raspberry PI.

Viktor Szabad
  • 13
  • 2
  • 4

1 Answers1

0

Add those commands to /etc/rc.local.

storm
  • 4,973
  • Do you mean /etc/init.d/rc.local? – Mostafa Ahangarha Mar 23 '16 at 17:14
  • You can use both , but the purpose of /etc/rc.local is to provide a place to put shell commands to run at boot without having to deal with the stop|start service stuff, which is in /etc/init.d/rc.local. – storm Mar 23 '16 at 17:19
  • Yes I want to create a shell which includes the above commands. Once that is done, do I need to put the script file in /etc/init.d/rc.local? – Viktor Szabad Mar 23 '16 at 17:23
  • You don't have to make a script , just add the commands in the end of the file before exit 0 – storm Mar 23 '16 at 17:29