hi

Ship's Log, Lt. [EMAIL PROTECTED], Stardate 221298.0927:
> Hi,
> 
> Actually, to get mail from my ISP (POP3 server), I do 
> 
> pon
> popclient -v mail.infonie.fr -u frleg
> poff
> 
> I would like my system to get automatically my mails :
>    every hours if I am not connected (so it will have to connect en 
> disconnect by itself)
>    every half an hour (for example) if I am connected (without disconnecting 
> me)
> 
> I read several HOWTOs and didn't find good explanation. What is the solution :
> Using scripts ? (Have you some ?)
> Using things like diald ?

I wrote 2 zsh scripts for myself which do something like this. 

they may not be a pretty good style, so if someone want to send me
enhancements feel free to do so ;-)


Greetings
-- 
Alexander N. Benner  -  The Seven Promises of a Promise Keeper:  -3-

A Promise Keeper is committed to practicing spiritual, moral, ethical,
and sexual purity.
#!/usr/bin/zsh

#keeps pattern as filename if no match
setopt nonomatch

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin

if ! test -f ~/.online/*
then
    until (route|grep rusmax1 >/dev/null)  # I wait for the def. route
    do
        ipon       # a bin of mine which is sim. to pon just isdn
        sleep 5
        if (route|grep 129.69 >/dev/null) # sometimes something goes wrong
        then
            ping -c 1 129.69.18.28
            #sleep 3
            #route add default ippp0 
        else
            #sleep 3
        fi
    done
fi

#that is the importent part ...
#I count the times the script was called 
#offline will go only offline if noone want to be online anymore

touch ~/.online/`expr 0\`ls ~/.online|tail -1 \` + 1`
#!/usr/bin/zsh

setopt nonomatch

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin

if test -f ~/.online/*
then
    sendmail -q
    #send all remaining EMails

    count=30

    #Wait until mailq is empty, up to a max of 5 min.
    until ((mailq|grep 'Mail queue is empty' >/dev/null)||test $count -eq 0)
    #while (mailq|egrep -v '^$'>/dev/null)
    do
      sleep 10
      count=`expr $count - 1`
    done

    #one person wat's to go offline
    rm ~/.online/`ls ~/.online|tail -1`

    #in case that was the last one remaining
    if ! test -f ~/.online/*
    then
        #go offline (yupp, again my bin for isdn)
        ipoff
    fi

fi

Reply via email to