*BSD News Article 71388


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.mel.connect.com.au!news.mira.net.au!news.vbc.net!garlic.com!news.scruz.net!kithrup.com!news.Stanford.EDU!agate!theos.com!riscan.riscan.com!van.istar!van-bc!unixg.ubc.ca!news.bc.net!arclight.uoregon.edu!news.uoregon.edu!vixen.cso.uiuc.edu!newsfeed.internetmci.com!news1.erols.com!newsmaster@erols.com
From: Ken Bigelow <kbigelow@www.play-hookey.com>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Polling remote host for mail -- suggestions?
Date: Tue, 18 Jun 1996 16:09:40 -0700
Organization: Erols Internet Services
Lines: 52
Message-ID: <31C73733.5358@www.play-hookey.com>
References: <4q6hpt$31o_016@mypc.neosoft.com>
NNTP-Posting-Host: kenjb05.play-hookey.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.02 (Win16; I)

Conrad Sabatier wrote:
> 
> I'd like to use popclient to poll my ISP for my mail, say, every ten
> minutes.  Looking at the cron docs, it appears that it expects a list of
> specific date/time parameters, or am I overlooking something?  Can cron be
> given a set of parameters that say "every ten minutes"?  If not, then how
> can I do this some other way?
> 
> If someone could just point me in the right direction, it would be greatly
> appreciated.
> 

This is exactly what I do, since I have accounts with two ISPs that I 
started before I set up my own domain. I use one cron-driven shell script to 
pull mail from both and to also pull down e-mail from my kids' accounts at 
the University of Maryland while they are home for the summer. Basically, 
you need to create one file and edit another.

I did it this way: First, I created /usr/sbin/chekmail in the following 
format (add comments to taste):

#! /bin/sh
#
popclient -s -3 -u {userid} -p {password} -o {local mailfile} {mailhost}
    |
    |
# repeat for other host accounts as needed

Be sure to include the -s (silent) option, or your root mail account will 
*really* get cluttered. Also be sure that *only* root has rw permission for 
this file, since the passwords have to be in plain text -- they are the 
passwords for the accounts on the remote ISP mailhosts. You *will* get mail 
for root every time popclient fails to reach a host for any reason (such as 
timeout).

Now, edit the file /etc/crontab, which is the controlling file for all cron 
functions. First, look at the line for /usr/libexec/atrun; your new line 
will be very similar. Mine runs my chekmail program every 15 minutes, and 
looks like this:

#minute	hour	mday	month	wday	who	command
#
#Check other ISPs for mail every 15 minutes
*/15	*	*	*	*	root	/usr/sbin/chekmail

You don't have to reboot or re-HUP the cron daemon -- it checks for an 
updated /etc/crontab file each minute when it runs its tasks.

This arrangement has been running cleanly for me since I installed it a 
couple of months ago, and I expect it will also work for you.

Ken