Shutting down ppp

This is a discussion on Shutting down ppp within the Linux Networking forums, part of the Linux Forums category; I am running a dial-up connection on a shared phone line. I have something on dial on demand, but ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-21-2004
Doug Laidlaw
 
Posts: n/a
Default Shutting down ppp

I am running a dial-up connection on a shared phone line. I have something
on dial on demand, but that isn't really an issue. What I would like to do
is disconnect at a certain time with either cron or the at command. What
is the command I have to execute to do this? I have read about "sending a
SIGHUP" or something. How do I do that? I am connecting with kppp, but I
imagine that the shutdown command will operate on ppp itself.

Doug.
--
Commonwealth Youth Games, Bendigo, Australia- http://www.bendigo2004.com
The complete truth is not the prerogative of the human judge.
- Judge Meir Shamgar.

Reply With Quote
  #2 (permalink)  
Old 08-21-2004
hhh
 
Posts: n/a
Default Re: Shutting down ppp



Doug Laidlaw wrote:

> I am running a dial-up connection on a shared phone line. I have something
> on dial on demand, but that isn't really an issue. What I would like to do
> is disconnect at a certain time with either cron or the at command. What
> is the command I have to execute to do this? I have read about "sending a
> SIGHUP" or something. How do I do that? I am connecting with kppp, but I
> imagine that the shutdown command will operate on ppp itself.


In Debian there is a command 'poff (-a)' which closes all connections.

hh

Reply With Quote
  #3 (permalink)  
Old 08-21-2004
Stefan Viljoen
 
Posts: n/a
Default Re: Shutting down ppp

Doug Laidlaw wrote:

> I am running a dial-up connection on a shared phone line. I have something
> on dial on demand, but that isn't really an issue. What I would like to
> do
> is disconnect at a certain time with either cron or the at command. What
> is the command I have to execute to do this? I have read about "sending a
> SIGHUP" or something. How do I do that? I am connecting with kppp, but I
> imagine that the shutdown command will operate on ppp itself.
>
> Doug.


Hi

On my RedHat 9 system when I still had dialup I put down the line by killing
the pppd process:

ps -A -f | grep pppd

(you will see the pid in the leftmost column)

kill -1 pid

where "pid" is the number you see, referred to above)

Oh, and this IS I think wat is called "sending a SIGHUP" (hangup) = signal
no. 1

Regards

--
---
Stefan Viljoen
Software Support Technician
Polar Design Solutions
Reply With Quote
  #4 (permalink)  
Old 08-21-2004
vhu
 
Posts: n/a
Default Re: Shutting down ppp

Stefan Viljoen wrote:
> On my RedHat 9 system when I still had dialup I put down the line by killing
> the pppd process:
>
> ps -A -f | grep pppd
>
> (you will see the pid in the leftmost column)
>
> kill -1 pid
>
> where "pid" is the number you see, referred to above)


If you have only one ppp connection which you would like to terminate,
you could do

killall -HUP pppd

which essentially does the same thing but you don't need to find the pid
for the process. :)
Reply With Quote
  #5 (permalink)  
Old 08-21-2004
dan
 
Posts: n/a
Default Re: Shutting down ppp



vhu wrote:
> Stefan Viljoen wrote:
>
>> On my RedHat 9 system when I still had dialup I put down the line by
>> killing
>> the pppd process:
>>
>> ps -A -f | grep pppd
>>
>> (you will see the pid in the leftmost column)
>>
>> kill -1 pid
>>
>> where "pid" is the number you see, referred to above)

>
>
> If you have only one ppp connection which you would like to terminate,
> you could do
>
> killall -HUP pppd
>
> which essentially does the same thing but you don't need to find the pid
> for the process. :)


On Redhat there is a script ipup ppp0; simply do the reverse ifdown ppp0

Dan

Reply With Quote
  #6 (permalink)  
Old 08-21-2004
sirix
 
Posts: n/a
Default Re: Shutting down ppp

Doug Laidlaw wrote:
> I am running a dial-up connection on a shared phone line. I have something
> on dial on demand, but that isn't really an issue. What I would like to do
> is disconnect at a certain time with either cron or the at command. What
> is the command I have to execute to do this? I have read about "sending a
> SIGHUP" or something. How do I do that? I am connecting with kppp, but I
> imagine that the shutdown command will operate on ppp itself.
>
> Doug.


If you want to make more automatic way Stefan Viljoen described, you can
use:

kill -HUP `pidof pppd`

Remmber to use `pidof pppd` instead of 'pidof pppd or "pidof pppd".
Possibly, you'll have to use something like /sbin/pppd instead of simply
pppd, depending on what you see after

ps aux |grep pppd


sirix.
Reply With Quote
  #7 (permalink)  
Old 08-21-2004
Timothy Murphy
 
Posts: n/a
Default Re: Shutting down ppp

hhh wrote:

> In Debian there is a command 'poff (-a)' which closes all connections.


I'm not sure why, but I run the following program (after compilation):
================================================== =
#include <signal.h>
#include <sys/param.h>
#include <pwd.h>
static char *trusted_env[]={"PATH=/usr/bin:/usr/sbin:/sbin:/bin",0};
main()
{
struct passwd *pwd;
int i;
uid_t uid;
for (i=0;i < NSIG;i++){ if(i!= SIGKILL && i!=SIGCHLD)
{(void) signal(i,SIG_IGN);}
}
uid=getuid();

if ( (pwd = getpwuid(uid))== (struct passwd *)0 )
exit(1);
setuid((uid_t)0);

execle("/usr/bin/killall","/usr/bin/killall","pppd",(char *)0,trusted_env);

setuid(uid);
exit(1);
}
================================================== =


--
Timothy Murphy
e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
Reply With Quote
  #8 (permalink)  
Old 08-22-2004
sirix
 
Posts: n/a
Default Re: Shutting down ppp

sirix wrote:

>
> If you want to make more automatic way Stefan Viljoen described, you can
> use:
>
> kill -HUP `pidof pppd`


I mean kill -9 `pidof pppd`... Like Walter Schiessberg said -HUP would
do nothing to pppd :-)


sirix.
Reply With Quote
  #9 (permalink)  
Old 08-22-2004
Moe Trin
 
Posts: n/a
Default Re: Shutting down ppp

In article <cg8kfg$hab$1@news.onet.pl>, sirix wrote:
>sirix wrote:
>> If you want to make more automatic way Stefan Viljoen described, you can
>> use:
>>
>> kill -HUP `pidof pppd`


killall -HUP pppd is easier.

>I mean kill -9 `pidof pppd`...


No, a -9 is the kill of last resort and should be used ONLY when a
process is ignoring ALL OTHER signals. In this case it would not clean
up afterwards - lock files, pid files, etc. VERY BAD IDEA.

> Like Walter Schiessberg said -HUP would do nothing to pppd :-)


Maybe you should look through the pppd man page again. What does this
first sentence mean to you?

SIGHUP This signal causes pppd to terminate the link,
restore the serial device settings, and close the
serial device. If the persist or demand option has
been specified, pppd will try to reopen the serial
device and start another connection (after the
holdoff period). Otherwise pppd will exit. If
this signal is received during the holdoff period,
it causes pppd to end the holdoff period immedi-
ately.

SIGHUP is normally used to bypass the idle time value when the link
is idle - meaning hang up now, rather than when the idle timer is
finished. It may also be useful when you are not using the link,
but the script kiddiez are knocking, and keeping the link busy
with unwanted trash.

Old guy

Reply With Quote
  #10 (permalink)  
Old 08-22-2004
sirix
 
Posts: n/a
Default Re: Shutting down ppp

Moe Trin wrote:

> Maybe you should look through the pppd man page again. What does this
> first sentence mean to you?


My fault absolutelly. Sorry.


sirix.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:12 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0