Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Reset a stuck internet connection Internet
Lately, my dialup connection gets wedged, and I cannot disconnect and reconnect, because the GUI seems to be stuck. I found a quick fix. If you send a HUP signal to the pppd process, it unwedges everything, and disconnects.

"Sending a signal" is a UNIX thing, and it requires you to use the Terminal. First, type ps ax to list all the processes and numbers. The numbers are the first digits in each line of results, and they're important for the next step. Find the pppd process, and then issue a kill command: kill -HUP 1234, where 1234 is replaced by the id for pppd process you found in the previous step.
    •    
  • Currently 2.50 / 5
  You rated: 2 / 5 (4 votes cast)
 
[8,839 views]  

Reset a stuck internet connection | 11 comments | Create New Account
Click here to return to the 'Reset a stuck internet connection' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Norrow down that 'PS' output by piping it to 'GREP'
Authored by: Cerberus on Jun 01, '02 09:59:53PM

You can modify your 'ps ax' command to 'ps ax | grep pppd' and you will ONLY see 2 lines, the ACTUAL pppd deamon and the command you just typed in, like this:

3049 ?? Ss 0:06.75 pppd
4308 std S+ 0:00.03 grep pppd

This will save you having to scroll backwards to find pppd in that output and then just follow the rest of the tip.



[ Reply to This | # ]
Norrow down that 'PS' output by piping it to 'GREP'
Authored by: FlyBoy on Jun 01, '02 10:36:05PM

Or you could do the following and eliminate the grep process in the ps list:

ps ax | grep -v grep | grep pppd



[ Reply to This | # ]
Norrow down that 'PS' output by piping it to 'GREP'
Authored by: FlyBoy on Jun 01, '02 10:49:18PM

Here's an even better way to do it in one step:

kill -HUP `ps ax | grep -v grep | grep pppd | awk '{print $1}' `

This finds the process number for the pppd process and passes it to the kill command.



[ Reply to This | # ]
Norrow down that 'PS' output by piping it to 'GREP'
Authored by: ret on Jun 03, '02 02:36:54AM
grep pipe to grep? That's a cardinal sin! :-)

Do this:
ps ax | grep p[p]pd | ...

Using the regexp in there means the grep process won't match itself in the process listing.

cheers
RET

PS: How bad will the backslashitis be on this reply?

[ Reply to This | # ]
Script Menu Item
Authored by: Anonymous on Jun 02, '02 01:07:29AM
Create an AppleScript with the following and place it in your Script Menu Items folder. No need to open the terminal with this... Not sure you need the admin pass to kill pppd but put it in just in case (No dial-up access to test with). If not just remove with administrator privileges.

on run
do shell script "kill -HUP `ps ax | grep -v grep | grep pppd | awk '{print $1}' `" with administrator privileges
end run

[ Reply to This | # ]
Script Menu Item
Authored by: stetner on Jun 02, '02 02:14:20AM

How about:

sudo kill -HUP `cat /var/run/ppp0.pid`



[ Reply to This | # ]
No need to use ps at all!
Authored by: pmerrison on Jun 02, '02 05:30:20AM

The pid of the pppd process is automatically stored in a file by the pppd. If you type less /var/run/pppd0.pid you can see it (obviously this will only work if pppd is currently running). If for some reason you have more than one pppd running, their ids are stored in pppd1.pid, pppd2.pid etc..



[ Reply to This | # ]
ip-up script
Authored by: frane on Jun 02, '02 10:35:52AM

You can create a script called ip-up in /private/etc/ppp. Make that file executable and system will execute it every time you make a new dial-up connection.
Example:

root# more /private/etc/ppp/ip-up
#!/bin/sh
cat /var/run/natd.pid | awk '{ system ("kill -HUP "$1); exit }'



[ Reply to This | # ]
ip-up script
Authored by: Corydon76 on Jan 08, '03 06:59:23PM

Backticks make it easier.

kill -HUP `cat /var/run/pppd0.pid`



[ Reply to This | # ]
ip-up script
Authored by: capmikee on Aug 08, '04 11:30:30AM

I noticed in /tmp/ppp.log the following line after disconnecting from the menu bar:

Sun Aug 8 11:33:10 2004 : Terminating on signal 15.

Signal 15 is the TERM signal, not the HUP signal. I don't know if it makes much difference, but that's how the system does it.

Not being an awk user, I would use backticks instead:

kill -TERM `cat /var/run/ppp0.pid`

Remember, those are backticks, not apostrophes.



[ Reply to This | # ]
Process viewer anyone?
Authored by: CaptCosmic on Jun 02, '02 08:30:16PM

Wouldn't Process Viewer be an easier way to kill it?



[ Reply to This | # ]