Testing for connectivity at the beginning is futile - the connection can be lost at any point even after getmail connected successfully and started downloading messages. You should look for a way to get getmail to handle the failure even in the middle of retrieving mails. For this - google about getmail's configuration and options. I'm not familiar with that software.
Now about your script - the way you loop it means that you'll keep growing an unlimited chain of "sms" script processes, each waiting for its only child, look at the output of "ps" after letting it run for a while. Use "pstree" or "ps -ejH" if you have a better view of the relations between the processes. Instead, you should either (in decreasing order of recommendation): 1. Run "getmail" in daemon mode. 2. Use cron to fire it once in a while (be it once a day or every minute, it's up to you) and don't forget to use a lock file to prevent multiple getmail instances from running concurrently. 3. Use a loop, e.g. "while true; do ...; done" --Amos On 12 March 2014 09:00, <li...@sbt.net.au> wrote: > I have a basic script to watching mailbox for new emails with > cygwin/getmail, that works OK, BUT, occasionally, ADSL goes down, > generally, it comes back promptly, though, not always > > as a crude workaround, I looped the script to itself as so, that works, > but, if ADSL is down for longer time, it just loops endlessly and > unnecessarily: > > $ cat sms > #! /bin/sh > cd /home/voytek > LOG="/home/voytek/sms-record.log" > echo `date` "started" >> "$LOG" > cd getmail > ./getmail -i folder > echo `date` "ended" >> "$LOG" > /home/voytek/sms > > how can I make some basic connectivity test (against the mail server) to > delay getmail until connectivity exists ? > > > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- [image: View my profile on LinkedIn] <http://www.linkedin.com/in/gliderflyer> -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html