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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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. :) |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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 |