Click to See Complete Forum and Search --> : Post again - KPPP redial question
a556789
06-28-2001, 11:35 AM
I'm going to post this again since someone replied to other post but the reply didn't really answer my question...
I'm wondering if anyone can help me with a question. I'm using KPPP and I have a regular dialup connection to an ISP. What I want to be able to do is have it redial automatically if disconnected and email me it's new IP when it gets one after reconnecting.
Thanks in advance,
Adam
[Mystik_Cool]
06-28-2001, 11:44 AM
Oh I finally understand what's the purpose of this ! Like this u can connect yourself to your PC with another one in hollidays, on the beach ;)
Sorry but I don't have any idea about how to do that, but I wait an answer very impatiently ! It would be great, my ISP often disconnects me ! lol
Please mail me if you find smthing...
a556789
06-28-2001, 11:47 AM
No actually,
It's so I can telnet into my PC from work...
ille_pugil42
06-28-2001, 03:56 PM
as I stated earlier, this can be done and I've had a friend do this. Have a cron job check for connection (one way would be to run ifconfig and see if you have a valid IP), if you aren't connected, the cron script will reconnect you and then email the new IP. I haven't done this myself, but if you
man cron
at the CLI you can research. This will work, I've seen it in action.
tecknophreak
06-28-2001, 04:43 PM
one pc at home one at work?
have the one at home/work dialup the one at work/home then email the new ip to you?
if so, i might have a crazy solution for you.
wait, you connect to the isp and want to be able to telnet in. hmmm.. different.
[ 28 June 2001: Message edited by: tecknophreak ]
[Mystik_Cool]
06-28-2001, 07:12 PM
one pc at home one at work?
have the one at home/work dialup the one at work/home then email the new ip to you?
if so, i might have a crazy solution for you.
wait, you connect to the isp and want to be able to telnet in. hmmm.. different
Erm, thanx for your help, your post was very usefull :D
I'll search about this stuff on the net tomorrow, I'll mail you if I have any result adam... Please do the same for me...
[Mystik_Cool]
06-28-2001, 07:23 PM
I just tried a small search on google/linux, and all that I find is that, check it out... :
man cron (http://www.die.net/doc/linux/man/man8/cron.8.html)
cron (http://www.scrounge.org/linux/cron.html)
cron for redhat (http://www.redhat.com/support/docs/tips/cron/cron.html)
and the adresse of a cron daemon... (http://lists.berlios.de/mailman/listinfo/hc-cron-devel/)
It's 01h30 AM here, time for me to sleep... good luck !
[ 28 June 2001: Message edited by: [Mystik_Cool] ]
ille_pugil42
06-29-2001, 08:06 AM
at your pc itself, at the Command Line Interface (CLI - or prompt), type in
man cron
this will tell you the basics of how cron works. Do a forum search on cron and you should be able to figure it out. Basically, cron will run a script once every X, where x is every minute, every day, every month - whatever. So just write a script to see if you're online (perhaps one that reads the output from ifconfig, and if you're not online to reconnect and then email you with the new ip, again from ifconfig. Give me a day or two to get my linux box back up at home and I can get you the script that will check to see if you're online or not.
a556789
06-29-2001, 08:18 AM
Thanks for the help. I'll look into those searches myself.
ille_pugil42
06-29-2001, 08:33 AM
not a prob.
[Mystik_Cool]
06-29-2001, 08:39 AM
Ille_pugil42 ? It would be great if you could send me the script too... or simply post it here !
Else I think I'll lose many hours searching how to write this correctly, and for the moment I have not a lot of time to lose... lol
Many thanx, in advance...
:)
a556789
06-29-2001, 09:52 AM
I'd also like a copy of the script if you don't mind. Although I'll try and do it myself in the mean time. Thanks a lot for the help guys!
ille_pugil42
06-29-2001, 01:44 PM
it'll take a little work. In the process of reinstalling linux on my box. I'll post as soon as possible regarding such. As far as cron runs... I'm not quite sure. I'm happy to do research, tho.
Can I be included on that list too??? :D
I'm trying to sort it myself but be nice to have that as a backup for when I end up throwing my keyboard across the room!!
Thanks
Col
[Mystik_Cool]
06-29-2001, 02:26 PM
No problem, post it when you want. That's really nice from you to help us like that, thanx !! :)
ille_pugil42
06-29-2001, 02:31 PM
tell you what, just mail me and I'll email it out when it's done, as well as post when I can.
[ 29 June 2001: Message edited by: ille_pugil42 ]
[ 29 June 2001: Message edited by: ille_pugil42 ]
ille_pugil42
07-03-2001, 08:11 AM
been a busy, busy weekend, haven't had much time to code, but definitly progressing. The basic idea is to
ifconfig | grep 127.0.0.0
or
ifconfig | grep 127.0.0.1
I'm going to do this is c++ (because I'm not all that great with bash scripting)... if someone can help with the bash scripting, that'd be cool. P'raps we can solve it today.
bdg1983
07-03-2001, 08:35 AM
Are you lookinf for a script that will output the current ip address and then email it?
mail "someone@somewhere.com" < getIP
Probably not correct, but is that similar to what you are looking for?
bdg1983
07-03-2001, 08:41 AM
getIP script
#!/bin/bash
# getIP.sh
# the following is one line:
IPADDR=$(/sbin/ifconfig eth0|grep "inet addr" | awk '{print $2}' | awk -F: '{print $2}')
printf "IP address: $IPADDR\n"
I do have a couple of other scripts that do the same, but they are on my work pc and I'm on a day off today.
Is that what you are looking for?
a556789
07-03-2001, 09:22 AM
Actually,
I'm looking to probably grep the contents of ifconfig for inet addr and write that to a file and compare it to a newer file of the same contents every minute or so. If the files are different, I want the contents of the second one emailed to me so I'll know my new IP.
ille_pugil42
07-03-2001, 02:08 PM
essentially the same thing. I just don't know how to make IF work efficiently with bash scripting, else it would be really easy:
ifconfig | grep inet addr > /newip.txt
if newip.txt != ip.txt then /usr/bin/new_ip
where new_ip mails out the new ip and or reconnects.