Article View: news.software.readers
Article #84451Re: best way to call slrnpull?
From: Phil Boutros
Date: Tue, 18 Sep 2001 00:49
Date: Tue, 18 Sep 2001 00:49
96 lines
3506 bytes
3506 bytes
On Mon, 17 Sep 2001 23:18:27 GMT, LinuxBear <vlpbgcys@news.videotron.ca> wrote: > > Thanks very much Phil. I would love a copy of your other script OK. Here's the long script: #v+ #!/bin/bash # A script to get email and newsgroup messages automagically # from a cron job. # # Written by Phil after accidentally erasing the previous one # (also written by Phil). if [ -r /var/run/ppp0.pid ]; then echo "Connection already established..." su philb -c fetchmail slrnpull --expire slrnpull -h news.foo.bar --kill-log /var/foo/bar echo "That's all folks..." exit 1 else echo "Establishing connection...please hold..." /root/total sleep 50s if [ -r /var/run/ppp0.pid ]; then su philb -c fetchmail slrnpull --expire slrnpull -h news.foo.bar --kill-log /var/foo/bar echo "That's all folks..." /root/off exit 1 else until [ -r /var/run/ppp0.pid ]; do echo "Trying to establish connection every 10 minutes" sleep 10m /root/total sleep 50s done su philb -c fetchmail slrnpull --expire slrnpull -h news.foo.bar --kill-log /var/foo/bar echo "That's all folks..." /root/off exit 1 fi fi exit 0 #v- A few notes: The /root/total is a link to the script that establishes my PPP connection with my ISP. The 50s wait afterwards is to give it a chance to connect! Adjust accordingly. The /root/off is obviously a link to the script that shuts down my PPP connection. Obviously, philb is my main (only!) user, and the one who's mail I want to be retrieved! The reason this runs as root is only because the regular users don't have access to the file with my ISP's username and passwords. Also, because slrnpull will only run as root. Adjust accordingly depending on your permissions. Obviously, replace news.foo.bar and /var/foo/bar accordingly (if applicable). This script will leave you connected if you were connected when it started, and disconnect you if it brought up the PPP connection itself (once it's done with mail news, of course). Keep in mind I know very little about shell script. I stole the "if -r /var/run...etc" part from another script, and I've also seen it as "if -f". I don't know the difference, but this does work for me (and has for several years now). Run from cron as often as required (when my machine was up 24/7, I used to run it every 2 hours). Enjoy! Phil -- AH#61 Wolf#14 BS#89 bus#1 philb@total.net http://www.total.net/~philb http://eddiekieger.com "Power To The People" - BPP EKIII will ride with me again.
Technical Details
Message-ID:
<slrn9qd6dg.hu.philb@wolf14.nols.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!pln-e!spln!dex!extra.newsguy.com!newsp.newsguy.com!news1References:
<slrn9qao2r.2gv.vlpbgcys@localhost.localdomain> <slrn9qavdk.jj.philb@wolf14.nols.com> <slrn9qcsmg.j2.vlpbgcys@localhost.localdomain>Show Full Headers
Complete Article Headers
Message-ID: <slrn9qd6dg.hu.philb@wolf14.nols.com> Subject: Re: best way to call slrnpull? Date: Tue, 18 Sep 2001 00:49:04 +0000 From: Phil Boutros <philb@total.net> References: <slrn9qao2r.2gv.vlpbgcys@localhost.localdomain> <slrn9qavdk.jj.philb@wolf14.nols.com> <slrn9qcsmg.j2.vlpbgcys@localhost.localdomain> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!pln-e!spln!dex!extra.newsguy.com!newsp.newsguy.com!news1 Newsgroups: news.software.readers Organization: Total lack of... Lines: 95 NNTP-Posting-Host: p-792.newsdawg.com User-Agent: slrn/0.9.7.2 (Linux)