LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-29-2007, 08:07 PM   #1
orbit
Member
 
Registered: Sep 2006
Location: Australia
Distribution: Slackware
Posts: 176

Rep: Reputation: 30
Modem Script Support


Hi all .. On Slackware12, I have just setup an sl-modem driver to work with my acer laptop which is a wonderful thing when I am travelling. However, I am a little concerned at the number of commands needed to run in order to get the modem to start.

Would it possible to automate the following commands into one script?
(for the record, I have no experience in scripting and after some initial reading on bash commands, I feel pretty confused with all the syntax and am really not sure what to do).

The commands needed to start the modem are as follows:
(from a root terminal in kde)

1. ifconfig eth0 down #turn off LAN interface.
2. ifconfig eth1 down #turn off Wireless interface.
3. /etc/dakar-rules/slmodemd start --alsa hw:0 --country=AUSTRALIA #configure modem driver and country.

4. /usr/sbin/slmodemd #start modem daemon, N.B. this causes the terminal to pause with the daemon running, it is needed for kppp to connect and it has to remain open for the duration that you want the modem to work, it can be manually terminated with ctrl-c).

# Q. would I need another terminal to automatically open here to continue the command set, since the daemon command pauses the ability to input new commands, or would there be another way to continue the process..?

5. /usr/bin/kppp #(this command needs to be run as user?, not root.. or it can't connect to x server. ... how do i run a user command in a root terminal?).

* After kppp is disconnected and closed, would it be possible to automatically stop the modem daemon that is running in the terminal (ctrl-c), then exit that terminal shell, and then bring the networks back up *

# something perhaps like:

6. kill kppp # disconnect, close and exit kppp
7. ifconfig eth0 up # bring LAN interface up.
8. ifconfig eth1 up # bring wireless interface up.
9. exit #(the modem daemon terminal)

Any advice, suggestions or examples of how to get this to work will be gratefully received.

Thank you all very much in advance.

Orbit
 
Old 08-30-2007, 01:49 PM   #2
ChrisScott
Member
 
Registered: Nov 2006
Location: St Albans, England
Distribution: Fedora c3/5, Suse pro 10/openSuse 10.2, RHES, Zenwalk.....
Posts: 97

Rep: Reputation: 15
Hi Orbit.

Your commands are pretty much a script already!

Start with

Code:
#!/bin/bash
To get bash to interpret the script. Then just list the commands above with two exceptions.

1) Run /usr/sbin/slmodemd in the background by following the command with a ' &' character.
2) use sudo -u username /usr/bin/kppp to run as an unprivileged user.
 
Old 08-30-2007, 01:54 PM   #3
ChrisScott
Member
 
Registered: Nov 2006
Location: St Albans, England
Distribution: Fedora c3/5, Suse pro 10/openSuse 10.2, RHES, Zenwalk.....
Posts: 97

Rep: Reputation: 15
Oh yeah. You can use this useful test after the daemon incase it takes a while to get going...

Code:
/usr/sbin/slmodemd &

checkRunning='false'

while [ "$checkRunning" != 'true' ]; do
    /usr/bin/kppp
    if [[ $? == 0 ]]; then
        checkRunning=true
    fi
    sleep 1
done
That will keep trying the command every second until it works!

Hope that helps.
 
Old 09-04-2007, 10:51 PM   #4
orbit
Member
 
Registered: Sep 2006
Location: Australia
Distribution: Slackware
Posts: 176

Original Poster
Rep: Reputation: 30
Hi ChrisScott,

Thank you very much for your advice, the modem initialisation is now automated.

Have a nice day

Cheers

Orbit
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FAX modem support sailu_mvn Linux - Hardware 1 12-21-2005 04:24 PM
internal modem support tooparam Linux - Certification 1 12-01-2005 10:52 PM
Modem support mystic_durle12 Red Hat 3 06-23-2005 01:41 AM
Soundcard / Modem Support StevenF_2004 Linux - Hardware 6 07-06-2004 12:20 PM
Usb Modem Support - help please t0k3n Linux - Newbie 2 10-12-2003 01:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration