LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-01-2006, 03:54 AM   #1
djsbriscoe
LQ Newbie
 
Registered: Jan 2005
Posts: 5

Rep: Reputation: 0
Help debugging adsl dial script.


Hi,
I have got as far as getting my speedtouch 330 (Revision 4) to connect the internet by following the instructions on

http://www.linux-usb.org/SpeedTouch/ubuntu/index.html

I am using Kubuntu Edgy 6.10

I tested the setup by entering the following command

# sudo pppd call speedtch

This resulted in a successful connection. Fine so far.

I then issued the following command to shut down pppd

# sudo killall pppd

and followed up with the command

# sudo /etc/init.d/dial

The result of the last command was:

/etc/init.d/dial:line 5:while[[0-lt 40]]: command not found
/etc/init.d/dial:line 6:syntax error near unexpected token 'do'
/etc/init.d/dial:line 6:'do'

The bash script 'dial' is as follows

#!/bin/bash
modprobe ppp_generic
modprobe pppoatm
count=0
while [[ $((count++)) -lt 40 ]]
do
sync=$(dmesg | grep 'ADSL line is up')
if [ ! -z "$sync" ]
then
pppd call speedtch
exit 0
fi
sleep 1
done
echo "The SpeedTouch firmware did not load"

I would appreciate some help in debugging the above script or finding another way of connecting automatically at boot time.

Thanks,

David
 
Old 12-01-2006, 07:45 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Maybe something like:
Code:
#!/bin/sh
# /bin/sh is linked Bash(2) on GNU/Linux
count=0
modprobe ppp_generic
modprobe pppoatm
while [ $count -lt 40 ]; do
 # Find in syslog (default) this string once with time range of one minute:
 string="^`/bin/date "+%b.%e %H:%M"`.*ADSL line is up"
 grep -q -m1 "$string" /var/log/messages
 case "$?" in
  0) # If we find the string execute ppd and alert if it failed to load.
      pppd call speedtech && exit 0 || echo "The SpeedTouch firmware did not load";;
  *) # If we dont find the string increment the count and sleep.
     ((count++)); sleep 1;;
 esac
done
exit 0
Not tested so YMMV(VM).
 
Old 12-01-2006, 02:49 PM   #3
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi djsbriscoe,

I don't have that hardware but the script is very simple and should work. I copied it and commented the portions that are not of interest for the error you are reporting and it worked without any problem.

However, looking for the error line, it seems that you copied the script from the site to show us and your actual has little differences; I see that you didn't respect the space separation on the while line:
Code:
/etc/init.d/dial:line 5:while[[0-lt 40]]: command not found
This means that the contents of the line 5 is
Code:
while[[$((count++))-lt 40]]
instead of
Code:
while [[ $((count++)) -lt 40 ]]
If I'm right on this supposition, edit the file inserting the spaces that the script will work.

Osvaldo.

Last edited by osvaldomarques; 12-01-2006 at 02:51 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Shell script debugging rbautch Programming 11 07-20-2006 10:33 PM
Debugging a Bash Shell Script solarblast Linux - General 1 02-23-2006 01:44 AM
debugging configure script Avatar33 Programming 3 03-23-2005 04:35 PM
Backup Script Tweaking and Debugging KungFuHamster Programming 1 12-07-2003 02:30 PM
debugging dial-up on RedHat 8.0 firedude Linux - Networking 1 01-08-2003 02:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:26 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