Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i ran it as root and still got the same...
i did notice one other problem:
i tried for shits and grins to try a dial up (56k) connection and i was not able to even do that...
in the past hour i have reinstalled mandrake with minimum stuff... now i am able to connect via modem but not dsl...
i connected with the alcatel under mandrake in the automated box they have. it didnt stay connected...it was being timed like it was connected yet it says i wasnt...
i suspect some type of daemon was running because when i tried to connect with a 56 k modem for some reason THAT wouldnt work...
my friend it is now too late, i have gone and done the unconscienable...i have set my windows box as my router and moved the linux distro to a client computer and now can hook up to the web with no problem whatsoever...
Prodigius
The line will drop every 3/7 or so, so don't worry about having to switch it off! (just rerun pppd when that happens).
Congratulations! It's incredibly satisfying when it works isn't it. Took me nearly 5 weeks to figure my problem out.
Jim
-----------------------------------------------
#!/usr/bin/perl
#use strict;
use Net::Ping;
my $line;my $dummy;my $peer;my $ip1;my $ip2;my $ip3;my $ip4;my $p;my $field;
my $status="OK";
my $sleep=60;
my $peermissing=0;
my $peerunreach=0;
my $oldrecvpack=0;
my $recvpackets=0;
# sub performing restart of pppd and relevant process
##
sub restartppp {
system("killall pppd;pppd");
sleep 20;
system("/etc/rc.d/init.d/snortd restart");
}
# sub performing restart of usb and relevant process
##
sub restartusb {
system("/etc/rc.d/init.d/adsl restart");
}
# sub to update number of packets received on ppp0
##
sub updatepackets {
my $inpackets=0;
my $line;
my $dummy;
$line=`ifconfig ppp0 | grep "Paquets Re"`;
chomp $line;
($dummy,$inpackets)=split(":",$line);
$line=$inpackets;
($inpackets,$dummy)=split(" ",$line);
return $inpackets;
}
# Start of script
##
#Update number of packets the first time
$recvpackets=updatepackets();
$oldrecvpack=$recvpackets;
#open(LOG,">/var/log/checkpeer.log");
print "Starting to monitor ppp0 link\n";
while ($status ne "quit"){
#Testing if the ppp interface is OK by fetching the peer IP address
$line=`ifconfig ppp0 | grep inet `;
chomp $line;
($dummy,$dummy,$field)=split (":",$line);
($peer,$dummy)=split (" ",$field);
($ip1,$ip2,$ip3,$ip4)=split ("\\.",$peer);
if ($ip1<=0 || $ip1>255 || $ip2<=0 || $ip2>255 || $ip3<=0 || $ip3>255 || $ip4<=0 || $ip4>255){
$status="peer missing";
}
else{
#Test if we have received new packets on ppp0 to save pinging peer
$recvpackets=updatepackets();
if ($recvpackets > $oldrecvpack){
$oldrecvpack=$recvpackets;
$status="packets detected";
}
elsif ($recvpackets < $oldrecvpack){
$oldrecvpack=$recvpackets;
$status="interface reset";
}
else {# No packets received lately.Checking peer by pinging it ...
$p = Net::Ping->new("icmp");
if ($p->ping($peer,1)){
$status="peer reacheable";
}
else{
$status="peer unreacheable";
}
$p->close();
#Update packets count so next comparison takes the ping into account
$recvpackets=updatepackets();
$oldrecvpack=$recvpackets;
}
}
#From here, we take different actions depending on the previous results
if ($status eq "peer missing"){
$peermissing++;
print scalar(localtime()).": PPPD is being started (peer missing)\n";
restartppp();
#Increase sleep time each time in case pppd needs more time
$sleep=30+$peermissing*5;
if ($peermissing >= 5){
print scalar(localtime()).": USB is being restarted\n";
restartusb();
$sleep=120;
}
}
elsif ($status eq "peer unreacheable"){
$peerunreach++;
$sleep=5;
print scalar(localtime()).": PEER $peer is down ($peerunreach time(s))"."\n";
if ($peerunreach >= 5){
print scalar(localtime()).": PPPD is being restarted (peer unreacheable)\n";
restartppp();
#Increase sleep time each time in case pppd needs more time
$sleep=15+$peerunreach;
}
}
elsif ($status eq "packets detected"){
$sleep=30;
print scalar(localtime()).": PPP0 traffic increased to $recvpackets packets. Skipping ping"."\n";
}
elsif ($status eq "interface reset"){
$sleep=20;
print scalar(localtime()).": PPP0 interface reset $recvpackets packets. Skipping ping"."\n";
}
elsif ($status eq "peer reacheable"){
print scalar(localtime()).": PEER $peer is alive"."\n";
$sleep=60;
$peermissing=0;
$peerunreach=0;
}
print scalar(localtime()).": SLEEP for $sleep seconds\n";
sleep $sleep;
}
-------------------------------------------------
save as checkpeer.pl, run> perl checkpeer.pl
->this will rerun pppd 5 times in the event of a down connection...
i noticed that often when i reboot there is a line that says the system is trying to disconnect usb devices1 and 2. it seems to get stuck permanently...i often will manually turn the box off (i have ext3 fs but i still worry)...
what does that mean? do i need to un mount the /dev/usbdvfs?
i know i may be asking a lot but i have this problem that must be solved...
at shutdown i get :
usb device1 shutting down
and then it simply freezes and then i have to manually shut it off- which is not too bad because im using ext3 and it tends to fix itself at bootup but i dont believe this is the proper way to get it done...
have any idea how i can shutdown my connection and usb devices properly?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.