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

Script to stay online at all times Internet
Is there a way for me to let a script (or something similar) always check whether I'm online and to re-connect when I'm not? I have a dsl flat and would like my ftp and webserver to stay online. my isp tends to disconnect if after some idle time, and i'd rather not do a permanent ping which is good for "faking" user activity.

Looking forward to your hints
;-) maciana
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[3,999 views]  

Script to stay online at all times | 12 comments | Create New Account
Click here to return to the 'Script to stay online at all times' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
ping
Authored by: robh on Sep 04, '01 11:00:43AM

What's your definition of "permanent ping" ?

Why not call ping every 5 minutes or less frequently ?
Either do something like

ping -i 300 some.host

or

ping -c 1 some.host > /dev/null
^^ called from a cron job, scheduled to run every 5 minutes.



[ Reply to This | # ]
Use your email client ...
Authored by: eriks on Sep 04, '01 02:36:00PM

I also have an adsl flat rate and my provider cicks me off after several minutes of inactivity. I simply set Mail to check for new mail every minute. That works perfect.
eriks



[ Reply to This | # ]
ICQ or NFS works for me
Authored by: _merlin on Sep 04, '01 09:05:30PM

I usually have ICQ running and a remote filesystem mounted with NFS. It keeps me online. A cron job to occasionally ping a host should work, too.



[ Reply to This | # ]
ICQ or NFS works for me
Authored by: _merlin on Sep 04, '01 09:05:56PM

I usually have ICQ running and a remote filesystem mounted with NFS. It keeps me online. A cron job to occasionally ping a host should work, too.



[ Reply to This | # ]
Install your own mailserver!
Authored by: Anonymous on Sep 04, '01 10:00:38PM

If you install a mailserver like postfix and then install fetchmail. You can configure fetchmail to retrieve mail every few minutes from any numbers of accounts!

It will probably only take a few hours to get it going but then you can do all sorts of things like access your email from a web interface and log into your machine remotely to get mail.

It may be a bit of an over kill though :-)



[ Reply to This | # ]
Related question
Authored by: ggliddy on Sep 05, '01 02:22:58PM

Another question. How about if your IP is not static? Does anyone know a way for you to find the IP of your machine remotely if it got disconnected and had to reconnect automatically? Or maybe there is a way for OSX to get its own current IP and send it to you by email, etc each time it starts a new connection?



[ Reply to This | # ]
Re: Related question
Authored by: Darkshadow on Sep 05, '01 09:46:59PM
I don't know how to get the address directly, but I know of a way. If you use PPP, you can use this to get the IP:
  • netstat -nI ppp0 | while read a b c d e; do echo $d | grep [.]; done (There should be a forward slash before the dot there, but the board edited it out)
If you use something via Ethernet, you can do this one:
  • netstat -nI en0 | while read a b c d e; do echo $d | grep -v [A-z]; done
(I use PPP, so the second one is largely untested. It'll work fine as long as whatever method you are signing on with actually changes the ethernet port's IP address) Note that those are capital i's, not lowercase L's (netstat -nI). You could set either of those up as a cron job to have it email the IP address to you (as long as you have sendmail working to sending to email addresses outside your local network).

[ Reply to This | # ]
Related question [finding IP]
Authored by: Anonymous on Sep 06, '01 03:37:32AM

I use DYNDNS.org for this. It works great. You merely sign up for a free (donations accepted) account. It will be 'username.dyndns.org' when you want to reach it. (with "username" being whatever you choose when signing up.) Prior set-up of a dynamic dns client is required. I highly recommend DNSUpdate (by Julien Jalon) -- can be found at: http://mapage.noos.fr/jalon/ (last time I checked.)

After a simple configuration of the client -- fire up the daemon with a nice cocoa gui ... and there ya go. Any time you want to remotely reach your dyndns box, key in, for example "telnet username.dyndns.org" and it will resolve to your constantly updated IP if the DNSUpdate is configured and working correctly. Good Luck.



[ Reply to This | # ]
Related question [finding IP]
Authored by: ths on Sep 06, '01 05:52:13PM

This was a really great tip! I just signed up for dyndns.org and installed the also great and simple to use DNSUpdate. My question is now how to make Apache work over dyndns.org. After turning all the sharing options in the sharing panel I can telnet and ftp to my new host but when I try to access it by WWW I get Apache's "not properly configured" page. The rudimentary index.html in my Sites folder states that I should see an address next to Network Identity in the sharing panel but there is none and neither is there an IP. Typing in my dyndns.org host name doesn't help either. Any ideas?



[ Reply to This | # ]
Related question
Authored by: owain_vaughan on Sep 06, '01 06:25:42AM

How about:

ifconfig ppp0 | grep inet | awk '{ print $2 }'



[ Reply to This | # ]
Try: IP Reporter
Authored by: eriks on Sep 06, '01 03:34:12PM

Try IP Reporter, it will send you an email (to an html based email service) if your IP address has changed.
You'll get it on:
http://members.home.nl/vissering

eriks



[ Reply to This | # ]
Ping: alive/dead messsage?
Authored by: robleach on Nov 13, '03 08:57:06PM

Is there an option to ping so that it will return a simple alive/dead message like on other unix-based systems? It's annoying that my perl scripts with said system call aren't compatible on macs.



[ Reply to This | # ]