View Full Version : A few tips for dialup users running Linux
Mrkvonic
November 7th, 2009, 10:56 AM
Hi guys,
I need your help ...
There are hundreds of millions of dialup users in the world. And we want to help them use Linux. My article presents several tips and tricks on how to connect to the Internet using dialup on Linux, focusing on friendly distributions and modem hardware, but it's rather thin at the moment.
You can help make this tutorial even better, especially if you have personal experience you are willing to share.
http://www.dedoimedo.com/computers/dialup.html
Cheers,
Mrk
Ocky
November 7th, 2009, 11:44 AM
-{ Quote: "Hi guys,
I need your help ...
There are hundreds of millions of dialup users in the world. And we want to help them use Linux. My article presents several tips and tricks on how to connect to the Internet using dialup on Linux, focusing on friendly distributions and modem hardware, but it's rather thin at the moment.
You can help make this tutorial even better, especially if you have personal experience you are willing to share.
http://www.dedoimedo.com/computers/dialup.html
Cheers,
Mrk" }-
From the Linux Mint forums. Sorry no personal experience yet.
-{ Quote: "Re: dial-up with Linux Mint6
by nitehawk on Fri Apr 17, 2009 10:34 pm
I'm not a linux expert,...but I have managed to get my dialup working with Linux Mint 6. (It is also the same method to use for Ubuntu 8.10, also). First of all,...I don't know if a USB modem will work or not. I have external modems I've used in Mint, with no problems ("Modem Blaster", "Trendnet", "USRobotics" all external serial modems).
1. go to terminal,..type "sudo pppconfig" (give password,...enter).
2. fill out all the information in pppconfig and SAVE.
Then type: "sudo wvdialconf" (this will,..or should,... detect and set-up your modem)
3. Don't know if all this is necessary,..but I typed:
sudo adduser (yourusername) dip
sudo touch /etc/resolv.conf
sudo touch /etc/ppp/options
4. Then I rebooted.
5. go to terminal,....type "pon (yourispname)" ....this should start the modem dialing.
6. go to terminal,...type "poff" ....to end internet session.
7. While connected to the net,....open synaptic package manager,...and hit "upload" (or "reload")
8. After reloading synaptic,...download the program "Gnome-PPP"
EDIT: If you don't know your ISP's DNS (for the info in pppconfig,....use the "OpenDNS" numbers:
208.67.222.222 ................. 208.67.220.220 (it's free, legal,..and it works)." }-
chronomatic
November 7th, 2009, 11:51 AM
Back in the day (say 2001 or so) when I first began using Linux, I only had dial-up. I quickly had to give up and go back to Windoze because it was impossible to get a Winmodem working in Linux in those days. There was one company that had created Linux drivers for some Winmodems, but they wanted $30 a pop. I said hell with it and waited a few years until I got broadband. I have been using Linux ever since and don't plan on looking back. ;)
I feel really sorry for dial-up users, especially those who use Linux. I would just assume not to have the Internet at all if I had dial-up.
FastGame
November 8th, 2009, 12:58 AM
Hi, dial-up expert here. Problem is I have a major tragedy (death) in the family, if you can wait a day or two I'll be back with all one needs to know (easy & CL free).
Until then I'll leave some hints....
Ubuntu 9.10 sucks real bad for dial-up :thumbd:
Puppy is the king of all distro's, detects and has drivers for many internal PCI modems (external modems are a breeze). All other distro's should be ashamed of themselves.....::)
When my mind is clear I'll list all major distro's and what needs to be done.
Trespasser
November 8th, 2009, 06:21 PM
I had success with a Conexant pci modem in Ubuntu 9.04 (haven't tried it with Karmic yet) but it required using part of Dell's Conexant 8.04 tar package with Linuxant's latest tar package. The end result was I had a full speed dialup connection (5 to 6 KBs per second...same as in Windows). I did find that kppp had more features and worked better than the Gnome connect manager. This link should help explain how to do it...
https://help.ubuntu.com/community/DialupModemHowto
In the next few days I'll try it with Karmic. If I can get it to work I'll post a detailed howto.
Trespasser
November 9th, 2009, 03:21 PM
Success getting dialup going on a Conexant pci modem. I will post the procedure shortly. This is on a Karmic Desktop.
Trespasser
November 9th, 2009, 09:10 PM
****This is for hsf modems***************
First, you need to find out if your Conexant pci modem is supported. The best way is to use Terminal to check your Vendor device pci id with "lspci" :
lspci
0000:01:0b.0 Communication controller: Conexant HSF 56k Data/Fax Modem (rev 01)
Then, type "lspci -n" and look at the same identifying numbers to get the vendor:device id
lspci -n
0000:01:0b.0 0780: 14f1:2f00 (rev 01)
In this example, it's 14f1:2f00. Vendor ID is first part (14f1), then a ":" separates the Device ID (2f00).
Now see if your VendorID and DeviceID match those listed below...
VendorID=14F1 : DeviceID=2F00
VendorID=14F1 : DeviceID=2F01
VendorID=14F1 : DeviceID=2013
VendorID=14F1 : DeviceID=2014
VendorID=14F1 : DeviceID=2015
VendorID=14F1 : DeviceID=2016
VendorID=14F1 : DeviceID=2F10
VendorID=14F1 : DeviceID=2F11
VendorID=14F1 : DeviceID=2F12
VendorID=14F1 : DeviceID=2F13
VendorID=14F1 : DeviceID=2F14
VendorID=14F1 : DeviceID=2F20
VendorID=14F1 : DeviceID=4311
VendorID=127A : DeviceID=1025
VendorID=127A : DeviceID=2004
VendorID=127A : DeviceID=2005
VendorID=127A : DeviceID=2013
VendorID=127A : DeviceID=2014
VendorID=127A : DeviceID=2015
VendorID=127A : DeviceID=2016
VendorID=127A : DeviceID=4311
VendorID=127A : DeviceID=2114
VendorID=8086 : DeviceID=2416
VendorID=8086 : DeviceID=2446
VendorID=8086 : DeviceID=2486
VendorID=1106 : DeviceID=3068
VendorID=10B9 : DeviceID=5453
VendorID=10B9 : DeviceID=5457
VendorID=14F1 : DeviceID=2043
VendorID=14F1 : DeviceID=2044
VendorID=14F1 : DeviceID=2045
VendorID=14F1 : DeviceID=2046
VendorID=14F1 : DeviceID=2443
VendorID=14F1 : DeviceID=1631
VendorID=14F1 : DeviceID=1636
VendorID=14F1 : DeviceID=1637
If it does then you're probably in luck.
Next, make sure you have build-essential installed and it's dependencies. gcc and make are also required but are generally already installed.
Now, download this package...
http://www.bargweb.net/images/2009/november/hsfmodem-7.80.02.05-DiacoEdition.zip
Unzip it to /home/user-name.
Then...
cd hsfmodem-7.80.02.05-DiacoEdition
Issue these commands...
sudo make install
after the process has finished making and installing, then...
sudo hsfconfig
The last command builds the hsfmodem module.
If successful, your modem should now be ready at /dev/ttySHSF0.
***Ubuntu Karmic (9.10), Jaunty (9.04), Hardy (8.04) and SUSE (11.0, 11.1) users with HDA modems: installing the latest alsa-driver-linuxant package is necessary before installing this driver located here....
http://www.linuxant.com/alsa-driver/
I didn't install the alsa-driver. The only thing I found, at least in my case, was when the modem was dialing out you couldn't hear it. No big deal or I don't have an HDA modem.
Install either gnome-ppp or kppp to control your dialup connection.
A problem I encountered after this install was being allowed to connect to the ISP (a question of permissions). I solved that problem with the following...
sudo gedit /etc/rc.local
and add this...
chmod u+s /usr/bin/wvdial
This allowed me to connect.
Sources I used...
https://help.ubuntu.com/community/DialupModemHowto/Conexant
http://ubuntuforums.org/showthread.php?t=190728/
http://ubuntuforums.org/showthread.php?t=1308328
This process worked for Ubuntu Karmic kernel 2.6.31-14.
Good luck.
Mrkvonic
November 10th, 2009, 12:22 AM
Wow, thank you very much!
Mrk
Trespasser
November 21st, 2009, 12:26 AM
Howdy folks,
For those older linux users on dial-up with poor eyesight, or some other limitation, you can use this bash script to make Desktop launchers for those links you use most frequently. Just change the url link between the quotation marks , in my case "http://mail.google.com/mail/#inbox", save it as possibly "gmail.sh"...and make it an executable "chmod a+x gmail.sh". You'll need to make a copy of this script for each Desktop link you wish to use.
Start of code.....
#!/bin/bash
function Start_url_link # Start Firefox....
{
gnome-open "http://mail.google.com/mail/#inbox"
while ps ax | grep firefox | grep -v grep > /dev/null ; do
sleep .25
done
zenity --question --text="Do you wish to disconnect?" --ok-label=Yes --cancel-label=No
if [ $? = 0 ]; then # FYI...(0)=Yes, (1)=No
killall wvdial
fi
} # End of Firefox start....
ps -ef | grep -v grep | grep wvdial > /dev/null
if [ $? = 1 ]; then # wvdial is not running...
nohup wvdial > /dev/null & # dial...
sleep 25
Start_url_link
else # wvdial is running...start new link...
Start_url_link
fi
exit
End of code.....
Just install wvdial...configure wvdial.conf with your information (number, login name, password, etc), create a Desktop launcher with "bash /path/to/script" in the Command line and you're ready to go. This script will auto dial (if wvdial is configured properly), sleeps long enough for a connection to complete (still working on this part), opens your default browser with the link you provide, monitors to see when you close your browser, then pops up a box that offers to shutdown your connection should you wish (yes, just like Internet Explorer does...this was the big reason why I've never been able to get Dad to try Linux...he has poor eyesight and his hands slightly shake so he wanted that disconnect box to pop up). This really has been done for my Dad but I thought I'd share it.
If I had a place to upload this deb I made for the Karmic Conexant driver so that others could link to it that would be really nice.
BTW, once I get the connection timing thing worked out (I'm presently using a sleep 25 command) then I'll post it.
Later...
Mrkvonic
November 28th, 2009, 04:01 AM
Updated the article with your suggestions guys! Much appreciated!
Mrk
Ocky
November 28th, 2009, 06:56 AM
-{ Quote: "Updated the article with your suggestions guys! Much appreciated!
Mrk" }-
I see you have credited me with actually having tried dial-up, but all I did was find the post.
-{ Quote: "From the Linux Mint forums. Sorry no personal experience yet." }-
:) ???
Mrkvonic
November 28th, 2009, 12:07 PM
You provided the info :)
Mrk
Trespasser
December 5th, 2009, 10:49 PM
Hi,
This is my completed scripts for people who use dial-up under Gnome Linux (Karmic for me) as their means of connecting to the internet. The advantage of these scripts are they allow you to click on Desktop links you use most frequently which then activate wvdial, wait for a connection to be established, then calls your preferred browser (firefox in my case). Also, once you close out your browser the script offers to terminate the connection. You can choose "Yes" if you want to disconnect or "No" if you wish to click another Desktop link. Here's my first script, which I called myscript.sh, which basically carries out all the functions...
###############################################################################
#!/bin/bash
# needs libnotify-bin to be installed
###############################################################################
# Function 1
function chk_if_online
{
if [ ! -f /var/run/ppp0.pid ]; then # if no ppp0.pid exists
until [ -e /var/run/ppp0.pid ]; # loop until value exists
do
sleep 0.1
done
notify-send "Connection established..."
Start_browser # first time connect after bootup
else # not first time connect after bootup
Oldpid="$(cat /var/run/ppp0.pid)" # Read current ppp* pid
Newpid=$Oldpid # Set Newpid = Oldpid
until [[ $Oldpid != $Newpid ]]; # Loop until condition met
do
Newpid="$(cat /var/run/ppp0.pid)" # Read current ppp* pid
done
notify-send "Connection established..."
Start_browser
fi
}
###############################################################################
# Function 2
function Start_browser # start browser....
{
#notify-send "10 minute online time limit in effect"
$browser $url
until [ -e $(pidof $browser) ]; # give browser enough time to open
do
sleep 0.1
done
while ps ax | grep -v grep | grep $browser > /dev/null ; do # check if browser is running
sleep 0.5
done # when browser no longer running...ask to disconnect
#timer
zenity --question --text="Do you wish to disconnect?" --ok-label=Yes --cancel-label=No
if [ $? = 0 ]; then # FYI...(0)=Yes, (1)=No
disconnect
fi
if [ -e $(pidof $browser) ]; then
killall $browser
fi
}
###############################################################################
# Function 3
function timer
{
FINISH_TIME=`date +%s`
SECONDS=$((FINISH_TIME - START_TIME))
if [ "$SECONDS" -gt "$TIME_LIMIT" ]; then
notify-send "Online time limit reached..." \ "Disconnecting"
disconnect
fi
}
###############################################################################
# Function 4
function disconnect
{
killall wvdial >/dev/null # kill wvdial
notify-send "Disconnecting..."
kill $$
exit 0
}
###############################################################################
# Main execution section
browser="firefox"
# Replace firefox with opera or epiphany-browser or chromium-browser or arora, or etc.
# Needs to be process name (open browser then look in System Monitor).
# Also, make sure your preferred browser is list as default in Preferred Applications
#TIME_LIMIT=600 # 10 minute time limit
#START_TIME=`date +%s`
link=$@
# Desktop links
if [ $link -eq 1 ]; then
url="http://my.yahoo.com/index.html"
fi
if [ $link -eq 2 ]; then
url="http://www.ebay.com/"
fi
if [ $link -eq 3 ]; then
url="http://www.facebook.com/home.php?"
fi
if [ $link -eq 4 ] ; then
url="http://www.ubuntuforums.org/"
fi
if [ $link -eq 5 ] ; then
url="http://www.google.com/ig"
fi
if [ $link -eq 6 ] ; then
url="http://mail.google.com/mail/#inbox"
fi
# add more url links here if you wish
# end of Desktop links
ps -ef | grep -v grep | grep wvdial > /dev/null
if [ $? = 1 ]; then # wvdial is not running...(0)=Yes, (1)=No
nohup wvdial 1>/dev/null 2>/dev/null & # dial...
chk_if_online
else # wvdial is running...start new link...
Start_browser
fi
########################################################################
To make Desktop links that call this script...right click in an open space on Desktop and choose Create Launcher...put in a name for your link (Facebook - Home, for example)...then in the Command line put...(the .scripts part is a hidden folder in my Home folder)...
bash /home/user-name/.scripts/myscript.sh 3
...the number at the end corresponds to the url link in the above script. Choose an icon for your link and click OK. You need to make a Desktop link for each url you wish to access from Desktop. Obviously, you need to change my url links to those you prefer.
As you can see, I put in a timer function at one point but decided to go with a cron job script instead. If you do not wish to use my cron job script but would like to use the timer then remove the "#" symbol in front of the following lines in the script...
#timer
#TIME_LIMIT=600 (600 seconds or 10 minutes...set to whatever you wish)
#START_TIME=`date +%s`
#notify-send "10 minute online time limit in effect"
The following is my cron job script ( I named it wvdial-browser-check.sh)...
#!/bin/bash
# cron job should look like this " */5 * * * * ~/.scripts/wvdial-browser-check.sh"
# Get dbus info
nautilus_pid=$(pgrep -u $LOGNAME -n nautilus)
eval $(tr '\0' '\n' < /proc/$nautilus_pid/environ | grep '^DBUS_SESSION_BUS_ADDRESS=')
export DBUS_SESSION_BUS_ADDRESS
browser="firefox"
# Replace firefox with opera or epiphany-browser or chromium-browser or arora, or etc
# needs to be process name (open browser then look in System Monitor).
wvdialpid=$(pidof wvdial)
browserpid=$(pidof $browser)
if [ -z $wvdialpid ]; then # checks if wvdial is running
echo ""
else
if [ -z $browserpid ]; then # if wvdial is running but browser is not, then...
notify-send "Disconnecting..."
killall wvdial
fi
fi
kill $$
exit
#####################################
The command to use the cron job is in the script above. It checks every 5 minutes to see whether wvdial is running or not. If it is, but your browser isn't, then it disconnects for you. If wvdial is running, as well as your browser, then it doesn't disconnect.
I saved both scripts (myscript.sh and wvdial-browser-check.sh) in a hidden folder (.scripts) in my Home folder.
One last thing. You need to install wvdial (and it's dependencies) and libnotify-bin for some really nice notifications like "Connection established...", "Disconnecting...", "10 minute online time limit in effect", or "Online time limit reached..." \ "Disconnecting". Each notification will display for 5 seconds. Also, to create a cron job open Terminal and enter "crontab -e". Copy and paste your cron job command, then Ctrl+Alt+x, Y (yes) to save, then Enter.
As I said, I made these scripts primarily so my Dad would use Linux. They make connecting and disconnecting very easy for him which is what I wanted. Hope they help someone else.
Later...
**Note**
I wrote this up late last night but this morning I'm finding all kinds of "errors". So, that's why the revisions. Sorry.
Trespasser
December 10th, 2009, 10:33 PM
Forget wvdial! Use pon/poff...plus you'll save about 3.5 MBs of disk space.
I've changed my script to conform to my switch to pon/poff. There's some differences between pon/poff and wvdial. Under wvdial when you boot up your computer /var/run/ppp0.pid doesn't exist (same with pon/poff) but on your subsequent dialouts ppp0.pid exists but the value changes...thus a different section in my last script to deal with that. Under pppd, /var/run/ppp0.pid is deleted each time you close your dialup connection. This fact simplified my new script a little bit. Here's my new script...
###############################################################################
#!/bin/bash
# Needs libnotify-bin to be installed for notification messages (about 65 KBs)
###############################################################################
# Function 1
function chk_if_online
{
until [ -e /var/run/ppp0.pid ]; do # loop until ppp0 pid exists
sleep 0.5
done
notify-send "Connection established..."
Start_browser
}
###############################################################################
# Function 2
function Start_browser # start browser....
{
$browser $url &> /dev/null
until [ -e $(pidof $browser) ]; # give browser enough time to open
do
sleep 0.1
done
BrowserCheck=`ps ax | grep -v grep | grep $browser` # check if browser is running
if [ ! "$BrowserCheck" ]; then # if not, then ask to disconnect
zenity --question --text="Do you wish to disconnect?" --ok-label=Yes --cancel-label=No
if [ $? = 0 ]; then # FYI...(0)=Yes, (1)=No
disconnect
fi
fi
exit
}
###############################################################################
# Function 3
function disconnect
{
poff
notify-send "Disconnecting..."
kill $$
exit
}
###############################################################################
# Main execution section
browser="firefox"
# Replace firefox with opera, epiphany-browser, chromium-browser, arora, or etc.
# Needs to be process name (open browser then look in System Monitor)
# Also, make sure your browser of choice is listed as default in Preferred Applications
url="$@"
# make Desktop launchers with this format...bash /home/user-name/myscript.sh "http://mail.google.com/mail/#inbox"
killall $browser # make sure another instance of browser is not running
ps -ef | grep -v grep | grep pppd > /dev/null # check if pppd is running
if [ $? = 1 ]; then # if no, then...(0)=Yes, (1)=No
pon your-ISP's-name # dial...
chk_if_online
else # if yes, then start new Desktop link...
Start_browser
fi
########################################################################
Here's the script I call with a cron job to insure the connection is monitored to prevent forgetting to disconnect....
####################################################
#!/bin/bash
# cron job should look something like this... */10 * * * * ~/.scripts/pppd-browser-check.sh
# Get dbus info...(needed for libnotify-bin)...
nautilus_pid=$(pgrep -u $LOGNAME -n nautilus)
eval $(tr '\0' '\n' < /proc/$nautilus_pid/environ | grep '^DBUS_SESSION_BUS_ADDRESS=')
export DBUS_SESSION_BUS_ADDRESS
browser="firefox"
# Replace firefox with opera, epiphany-browser, chromium-browser, arora, or etc.
# Needs to be process name (open browser then look in System Monitor)
# Also, make sure your browser of choice is listed as default in Preferred Applications
pppdpid=$(pidof pppd)
browserpid=$(pidof $browser)
if [ -z $pppdpid ]; then # pppd not running
echo ""
else
if [ -z $browserpid ]; then # if pppd is running but browser is not (-z=null -n=not null)
notify-send "Disconnecting..."
poff
fi
fi
kill $$
exit
####################################################
When creating Desktop launchers use this format....
bash /home/user-name/.scripts/myscript.sh "http://mail.google.com/mail/#inbox"
Just drop the links you want to use between the quotation marks. Hope someone can use it. It makes dial-up under Linux a whole lot easier. :).
Later...
Trespasser
December 13th, 2009, 10:56 PM
This version is much simpler than previous versions and works great (needs libnotify-bin installed for the cool notifications)...
####################################
#!/bin/bash
if [ ! -d ~/.scripts/counter ]; then # Does config directory exist?
mkdir ~/.scripts/counter
touch ~/.scripts/counter/end-time
fi
START_TIME=`date +%s`
echo "$START_TIME" > ~/.scripts/counter/end-time
browser="firefox" # Replace firefox with opera, epiphany-browser, arora, etc.
url="$@" # Desktop launcher should look something like this...
# bash /home/user-name/myscript.sh "http://www.google.com/ig", for example
ps -ef | grep -v grep | grep pppd > /dev/null # check if pppd is running
if [ $? = 1 ]; then # if not connected, then... (1)=No
pon Your-ISP # dial...
until [ -e /var/run/ppp0.pid ]; do # loop until ppp0 pid exists
sleep 0.1
done
sleep 2 # give enough time for connection to establish
notify-send "Connection established..."
fi
$browser $url &> /dev/null
BrowserCheck=`ps ax | grep -v grep | grep $browser` # check if browser is running
if [ ! "$BrowserCheck" ]; then # if not, then ask to disconnect
zenity --question --text="Do you wish to disconnect?" --ok-label=Yes --cancel-label=No
if [ $? = 0 ]; then # FYI...(0)=Yes, (1)=No
poff
notify-send "Disconnecting..."
kill $$
fi
fi
END_TIME=`date +%s`
echo "$END_TIME" > ~/.scripts/counter/end-time
killall $browser # make sure another instance of browser is not running
exit
####################################
Here's the script that monitors the connection to check whether the browser is still open at certain intervals. Not really needed for most folks. It's aimed at older or real young people who might forget to disconnect...
#####################################
#!/bin/bash
# cron job should look something like this... */10 * * * * ~/.scripts/pppd-browser-check.sh
browser="firefox" # Replace firefox with opera, epiphany-browser, arora, midori, etc.
nautilus_pid=$(pgrep -u $LOGNAME -n nautilus)
eval $(tr '\0' '\n' < /proc/$nautilus_pid/environ | grep '^DBUS_SESSION_BUS_ADDRESS=')
export DBUS_SESSION_BUS_ADDRESS
TIME_LIMIT=120 # <in seconds...set idle time limit on open connection (browser closed)
CHECK_TIME=`date +%s`
CLOSE_TIME="$(cat ~/.scripts/counter/end-time)"
SECONDS=$((CHECK_TIME - CLOSE_TIME))
pppdpid=$(pidof pppd)
if [ -z $pppdpid ]; then # pppd is not running
echo "$CHECK_TIME" > ~/.scripts/counter/end-time
else # pppd is running
if [ ! $(pidof $browser) ]; then # then, if pppd is running but browser is not
if [ "$SECONDS" -gt "$TIME_LIMIT" ]; then
poff
notify-send "Disconnecting..."
fi
fi
fi
kill $$
exit
#####################################
These scripts work great for my Dad and me. If you have any questions please ask away.
Trespasser
January 7th, 2010, 10:10 PM
A point or two that I've discovered about pppd here recently. Open /etc/ppp/options as root and look it over. Three of the more interesting options were...
***These three options will need to be activated to use them. Just remove the "#" in front of each entry to enable***
#persist...
it monitors your dialup connection and if dropped it redials after a predetermined amount of time (that I was never able to find out)
#maxfail <n>...
sets a maximum number of time that a redial will be attempted (default is 10)
#holdoff <n>...
sets in seconds how long to wait before attempting a redial after a connection is lost
The reason I found them interesting was once in a random while on attempting to dialout I was unable to establish a connect. The fault could have been my ISP, my modem, the driver, myscript...who knows. I tried many different approaches to restart pon in that situation but had little success. Then I found these options and life became much simpler.
#######################################################
#!/bin/bash
if [ ! -d ~/.scripts/counter ]; then # Does config directory exist?
mkdir ~/.scripts/counter
touch ~/.scripts/counter/time-keeper
fi
START_TIME=`date +%s`
echo "$START_TIME" > ~/.scripts/counter/time-keeper
browser="firefox" # Replace firefox with opera, epiphany-browser, arora, etc.
ISP="" # Put your ISP's name between the two quotation marks that you configured with pppconfig
url="$@" # Desktop launcher should look something like this...
# bash /home/user-name/myscript.sh "http://www.google.com/ig", for example
ps -ef | grep -v grep | grep pppd > /dev/null # check if pppd is running
if [ $? = 1 ]; then # if not connected, then... (1)=No
pon $ISP # dial...
notify-send "Dialing..."
until [ -e /var/run/ppp0.pid ]; do # loop until ppp0 pid exists
sleep 1
done
# double check connection is established
until [[ `ifconfig ppp0 | grep -v '127.0.0.1' | grep 'inet addr'` ]]; do
if [ $? = 0 ]; then # (0)=Yes
break # then break from the loop
else
sleep 1 # else pause for one second and loop back
fi
done
notify-send "Connection established..."
fi
$browser $url &> /dev/null
BrowserCheck=`ps ax | grep -v grep | grep $browser` # check if browser is running
if [ ! "$BrowserCheck" ]; then # if not, then ask to disconnect
zenity --question --text="Do you wish to disconnect? " --ok-label=Yes --cancel-label=No
if [ $? = 0 ]; then # (0)=Yes
poff
notify-send "Disconnecting..."
kill $$
fi
fi
END_TIME=`date +%s`
echo "$END_TIME" > ~/.scripts/counter/time-keeper
exit
########################################################
My cron timer.........
########################################################
#!/bin/bash
# cron job should look like this */3 * * * * ~/.scripts/pppd-browser-check.sh
browser="firefox" # Replace firefox with opera, epiphany-browser, arora, etc.
nautilus_pid=$(pgrep -u $LOGNAME -n nautilus)
eval $(tr '\0' '\n' < /proc/$nautilus_pid/environ | grep '^DBUS_SESSION_BUS_ADDRESS=')
export DBUS_SESSION_BUS_ADDRESS
TIME_LIMIT=180 # <in seconds...set idle time limit on open connection (browser closed)
CHECK_TIME=`date +%s`
CLOSE_TIME="$(cat ~/.scripts/counter/time-keeper)"
SECONDS=$((CHECK_TIME - CLOSE_TIME))
pppdpid=$(pidof pppd)
if [ -z $pppdpid ]; then # pppd is not running
echo "$CHECK_TIME" > ~/.scripts/counter/time-keeper
else # pppd is running
if [ ! $(pidof $browser) ]; then # pppd is running but browser is not
if [ "$SECONDS" -gt "$TIME_LIMIT" ]; then # if time limit exceeded
poff # then disconnect
notify-send "Disconnecting..."
fi
fi
fi
kill $$
exit
#######################################################
This should be the last version. Just trying to help.
Later....
Ocky
January 8th, 2010, 02:29 AM
-{ Quote: "
This should be the last version. Just trying to help.
" }-
Thank you for your sterling efforts Trespasser. I am sure many users with dial-up will benefit. :thumb:
Trespasser
January 13th, 2010, 03:51 PM
This pon dialup script waits for your primary and secondary DNS to show up in /var/log/messages before opening your browser. Much simpler and more dependable. I also suggest that you open /etc/ppp/options with your favorite text editor (as root) and enable persist (remove the "#" from in front the entry) as well as maxfail (default is 10 if not enabled).You could also enable holdoff (recommended is 10 seconds but I put mine at 5). Holdoff starts the redial process if a connection is dropped. Hope this helps someone.
#!/bin/bash
if [ ! -d ~/.scripts/counter ]; then # Does config directory exist?
mkdir ~/.scripts/counter
touch ~/.scripts/counter/time-keeper
fi
START_TIME=`date +%s`
echo "$START_TIME" > ~/.scripts/counter/time-keeper
browser="firefox" # Replace firefox with opera, epiphany-browser, arora, etc.
ISP="" # Put your ISP name that you entered in pppconfig between the quotation marks
url="$@" # Desktop launcher should look something like this...
# bash /home/user-name/myscript.sh "http://www.google.com/ig", for example
ps -ef | grep -v grep | grep pppd > /dev/null # check if pppd is running
if [ $? = 1 ]; then # if not connected, then... (1)=No
notify-send "Dialing..."
pon $ISP # dial...
while :; do
tail -n 2 /var/log/messages | grep DNS # Waits for primary and secondary DNS
if [ $? = 0 ]; then # to show up before opening browser
break
fi
done
notify-send "Connection established..."
fi
$browser $url &> /dev/null
BrowserCheck=`ps ax | grep -v grep | grep $browser` # check if browser is running
if [ ! "$BrowserCheck" ]; then # if not, then ask to disconnect
zenity --question --text="Do you wish to disconnect? " --ok-label=Yes --cancel-label=No
if [ $? = 0 ]; then # (0)=Yes
poff
notify-send "Disconnecting..."
kill $$
fi
fi
END_TIME=`date +%s`
echo "$END_TIME" > ~/.scripts/counter/time-keeper
killall $browser # make sure another instance of browser is not running
exit
Guess THIS is my last version...but you never know. :).
Later....
clansman77
January 14th, 2010, 01:16 AM
thanks trespasser.your efforts are commendable and i am sure will help a lot of dialup users.it did help me once to configure a conexant winmodem in ubuntu.thank you.
iceni60
January 28th, 2010, 05:06 PM
i just recognised a url in my search results. it's a site i used years a go to get my dialup working 8) it worked for me in 2004/5, maybe it can still be useful? this is for the Alcatel SpeedTouch USB Modem.
http://steve-parker.org/speedtouchconf/
vBulletin® Copyright ©2000-2012, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2012, Wilders Security Forums