1

This question already has an answer here:

I have an TL-WN727N wireless adapter connected to my laptop. Every time I start my laptop I must manually enter those two commands in a terminal:

  1. echo 'install rt2800usb modprobe --ignore-install rt2800usb ; /bin/echo "148f 5370" > /sys/bus/usb/drivers/rt2800usb/new_id' | sudo tee /etc/modprobe.d/rt2800usb.conf
    
  2. sudo modprobe -v rt2800usb
    

Is it possible to automatically run those two commands on startup to enable my internet connection?

marked as duplicate by TellMeWhy, Jacob Vlijm, Seth Nov 26 '15 at 15:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

I did this in Ubuntu 14.04.3

You need root privileges to do this, so be careful.

sudo su

There is several ways to do this, I did something similar to unblock my wireless card when resume.

Just create a script in /etc/init.d/ (name it as you want, I'll name it "wireless")

nano /etc/init.d/wireless

inside your script, write your commands

#!/bin/sh
install rt2800usb modprobe --ignore-install rt2800usb ; /bin/echo "148f 5370" > /sys/bus/usb/drivers/rt2800usb/new_id' | sudo tee /etc/modprobe.d/rt2800usb.conf
sudo modprobe -v rt2800usb

Save it, CTRL+X then Y (in nano)

Once in the script folder, run

chmod +x /etc/init.d/wireless

And then

update-rc.d wireless defaults

As I said, there's several ways to do this, but this worked for me.

0

You can use crontab as one option

  1. Goto a terminal
  2. Enter crontab -e (e used for editing, -l used for listing)
  3. insert the following commands in crontab

@reboot echo 'install rt2800usb modprobe --ignore-install rt2800usb ; /bin/echo "148f 5370" > /sys/bus/usb/drivers/rt2800usb/new_id' | sudo tee /etc/modprobe.d/rt2800usb.conf;sudo modprobe -v rt2800usb

or prepare a shell script as /user/home/temp.sh

    #!/bin/bash
    echo 'install rt2800usb modprobe --ignore-install rt2800usb ; /bin/echo "148f 5370" > /sys/bus/usb/drivers/rt2800usb/new_id' | sudo tee /etc/modprobe.d/rt2800usb.conf;sudo modprobe -v rt2800usb

and add this in crontab -e

    @reboot /user/home/temp.sh
0

Simplest way of doing this is to put the two commands in etc/rc.local

sudo nano /etc/rc.local

Add your lines before the command exit 0. So It will be something like,

#!/bin/sh -e
echo 'install rt2800usb modprobe --ignore-install rt2800usb ; /bin/echo "148f 5370" > /sys/bus/usb/drivers/rt2800usb/new_id' | sudo tee /etc/modprobe.d/rt2800usb.conf
modprobe -v rt2800usb
exit 0

Note: You dont need to put sudo, since the script will be executed as root. Sometimes you may also need a

sudo chmod +x /etc/rc.local

Not the answer you're looking for? Browse other questions tagged or ask your own question.