Can this line be a script/ be automated? [Solved]

Forum rules
Before you post please read this

Can this line be a script/ be automated? [Solved]

Postby tpprynn on Mon Jun 18, 2012 3:32 pm

I use Mobile Broadband, and there is currently a bug where the Huawei E173 dongle has to be kicked awake each boot with this terminal command before I can get online:

sudo modprobe usbserial vendor=0x12d1 product=0x1c10

I was thinking it must be possible to automate this in a simple script, or maybe it's even easier than that. In Mint 11 and 12/Ubuntu 11.04 and 11.10 this dongle worked fine without meddling.

This was maybe insanely naive, but I made a file called startdongle.sh with this in it:


#!/bin/sh

modprobe usbserial vendor=0x12d1 product=0x1c10


Then I moved that into the file system with the sudo mv command and changed the permissions with the sudo chmod u+x command and added this moved file to the startup programs (maybe this last step was unnecessary anyway?). I have only had one attempt at scripting before, which failed and frustrated enough to keep me away from it from then, but I've become curious again. I imagine this is stupidly easy to regular bash people - one little line. Presumably there is something about the form of the line which means the module can't be invoked with these parameters where they normally are in the filesystem.

Hopefully I haven't caused anyone's ribs to crack laughing... All help appreciated. Thanks.
Last edited by tpprynn on Mon Jun 18, 2012 5:21 pm, edited 1 time in total.
tpprynn
Level 3
Level 3
 
Posts: 149
Joined: Fri May 27, 2011 7:09 pm

Linux Mint is funded by ads and donations.
 

Re: Can this line be a script/ be automated?

Postby Habitual on Mon Jun 18, 2012 4:24 pm

I think you can edit (as root) the /etc/rc.local and make an entry for startdongle.sh in that file.
Code: Select all
sudo vi /etc/rc.local
and add a single line that reads:
Code: Select all
/absolute/path/to/startdongle.sh
What's a landing but a take off in reverse?
My DorkBlog
shellshock.conf for fail2ban 0.8.10
User avatar
Habitual
Level 8
Level 8
 
Posts: 2177
Joined: Sun Nov 21, 2010 8:31 pm
Location: LM17Q-Xfce

Re: Can this line be a script/ be automated?

Postby tpprynn on Mon Jun 18, 2012 5:21 pm

Thanks. It's turned out to be even simpler after finding a similar request for an automated terminal command function. The same /etc/rc.local file you suggest just has the

sudo modprobe usbserial vendor=0x12d1 product=0x1c10

added to it before the line begining 'exit'. So I've been able to get rid of the script.
tpprynn
Level 3
Level 3
 
Posts: 149
Joined: Fri May 27, 2011 7:09 pm

Re: Can this line be a script/ be automated? [Solved]

Postby Habitual on Mon Jun 18, 2012 6:09 pm

"sudo" is unnecessary when using /etc/rc.local

Code: Select all
modprobe usbserial vendor=0x12d1 product=0x1c10
should be sufficient.
What's a landing but a take off in reverse?
My DorkBlog
shellshock.conf for fail2ban 0.8.10
User avatar
Habitual
Level 8
Level 8
 
Posts: 2177
Joined: Sun Nov 21, 2010 8:31 pm
Location: LM17Q-Xfce

Re: Can this line be a script/ be automated? [Solved]

Postby tpprynn on Tue Jun 19, 2012 4:12 am

Thanks, I've amended that. I had just copied the form of the other example I found...
tpprynn
Level 3
Level 3
 
Posts: 149
Joined: Fri May 27, 2011 7:09 pm


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 1 guest