SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Distribution: Fedora c3/5, Suse pro 10/openSuse 10.2, RHES, Zenwalk.....
Posts: 97
Rep:
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.
Distribution: Fedora c3/5, Suse pro 10/openSuse 10.2, RHES, Zenwalk.....
Posts: 97
Rep:
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.