[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Part1 - Part2 - Single Page

Top Document: [news.software.readers] trn newsreader FAQ, part 2: Advanced
Previous Document: BLYC: Patches for "leap year bug"
Next Document: ICAU: If I read an article in one group, then mark it unread, how can it still appear as unread in groups to which it is crossposted?


ATKS: I want to set up a simple news archive. How can I run TRN non-interactively (e.g. as a cron job)?


Contributors: Michael Owings <mikey@waste.com>,
        Wayne Davison <trn@clari.net>,
        Peter J. Kappesser <Peter_Kappesser@promail.com>

Run the "trnkill" script included below from cron and it will enter
every subscribed group you have just long enough to run the kill file,
and then exit.

---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
#!/bin/sh
# trnkill - shell script to apply trn KILL files in the background
# 14 Mar 89  created for rn by Jim Olsen <olsen@XN.LL.MIT.EDU>
# 10 Sep 93  modified for trn 3 (or 2) by Wayne Davison <trn@clari.net>
# Options: -d	debug mode -- you see all gory action as it happens.

# Visit all newsgroups (if trn asks about anything else, just say no)
export TRNINIT TRNMACRO RNMACRO
TRNINIT='-q -s -T -t -x +X'
TRNMACRO=/tmp/trnkill$$

# support for trn 2.x
RNMACRO=$TRNMACRO

# support for versions older than 3.6 on some systems
TERM=dumb ; export TERM

trap 'rm -f $TRNMACRO; exit' 1 2 3 15
cat >$TRNMACRO <<'EOF'
z  %(%m=[nf]?.q^J:n)^(z^)
^m ^(z^)
^j ^(z^)
EOF
if test X$1 = X-d; then
	echo "z" | trn
else
	echo "z" | trn >/dev/null 2>&1
fi
rm -f $TRNMACRO
exit 0
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---

If trn crashes when you try to run it as a cron job, it's a problem with
no terminal being set in the cron-run environment, which is confusing
trn.  Trn 3.6 fixes this problem by assuming that if you don't have TERM
set in your environment that your terminal is "dumb". The commands
"TERM=dumb" and "export TERM" in the trnkill script gets this to work
with older trns.

One application of this is to run trnkill in the background when you
login, so it will "pre-kill" all your newsgroups and you won't have to
wait as long for trn to process the killfiles when you're actually
reading news, especially in high-volume, high-noise newsgroups. (Read
your mail first, since you won't be able to run trn until trnkill
finishes; or set up a cron job to run shortly before you usually login.)

You can set up a simple news archive by setting the envariables DOTDIR,
KILLGLOBAL and KILLLOCAL to point to a directory with a special-purpose
.newsrc and killfiles. The killfiles contain commands to select and save
the desired articles. (See Subject: CVNF and Subject: CSKF in Part 1 of
this FAQ.) The maintainer of this FAQ uses this method to archive all
articles that mention trn in news.software.readers.



Top Document: [news.software.readers] trn newsreader FAQ, part 2: Advanced
Previous Document: BLYC: Patches for "leap year bug"
Next Document: ICAU: If I read an article in one group, then mark it unread, how can it still appear as unread in groups to which it is crossposted?

Part1 - Part2 - Single Page


[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
@tigerden.com (Peter J. Kappesser)

Last Update October 22 2009 @ 05:35 AM

Some parts © 2009 Advameg, Inc.