🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
7 messages
7 total messages Started by Michael Owings Wed, 12 Oct 1994 02:34
TRN: Running it NON-interactively
#11865
Author: Michael Owings
Date: Wed, 12 Oct 1994 02:34
11 lines
1005 bytes
Can TRN be run non-interactively (besides using the -c 
flag to check for news)?  I would like to have it run
(from cron),  process my kill file entries for selected
groups,  and then exit.

I have been told this was possible,  but cannot find
anything in the manual pages that would suggest how to
do it.

Thanx -- mikey
Re: TRN: Running it NON-interactively
#11881
Author: Wayne Davison
Date: Wed, 12 Oct 1994 16:25
37 lines
1971 bytes
According to Michael Owings <mikey@waste.com>:
> Can TRN be run non-interactively (besides using the -c 
> flag to check for news)?  I would like to have it run
> (from cron),  process my kill file entries for selected
> groups, and then exit.

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.
-- 
Wayne Davison
davison@borland.com
---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 <davison@borland.com>
# 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
trap 'rm -f $TRNMACRO; exit' 1 2 3 15
echo "z %(%m=[nf]?.q^J:n)^(z^)" > $TRNMACRO
echo "^m ^(z^)" >> $TRNMACRO
echo "^j ^(z^)" >> $TRNMACRO
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---
Re: TRN: Running it NON-interactively
#11901
Author: lvirden
Date: Thu, 13 Oct 1994 19:43
53 lines
2443 bytes
Here is an example from a shell script that I run:

#!/bin/ksh
# 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 <davison@borland.com>
# Options: -d	debug mode -- you see all gory action as it happens.

# Visit all newsgroups (if trn asks about anything else, just say no)
# Assumes either default KILL file location or that user has specified a
# KILLLOCAL and KILLGLOBAL environment variable.

export PATH=/home/lwv26/bin/sun4:$PATH
export TRNINIT TRNMACRO RNMACRO

debug=""
special=1
	while [ $# ] ; do
		case  "$1" in
		-d ) debug=-d ; shift ;;
		-n ) special="" ; shift ;;
		* ) break ;;
		esac
	done

TRNINIT='-q -s -T -t -x +X'
if	[ -n "$special" ] ; then # Kill files are in one directory
if	[ x"$KILLLOCAL" = x"" -a x"$KILLGLOBAL" = x"" ] ; then
TRNINIT='-q -s -T -t -x +X -EKILLLOCAL="%p/Kill/%C" -EKILLGLOBAL="%p/Kill/global"'
fi
fi

TRNMACRO=/tmp/trnkill$$
# support for trn 2.x
RNMACRO=$TRNMACRO
trap 'rm -f $TRNMACRO; exit' 1 2 3 15
echo "z %(%m=[nf]?.q^M:n)^(z^)" > $TRNMACRO
echo "^m ^(z^)" >> $TRNMACRO
echo "^j ^(z^)" >> $TRNMACRO
if test X$debug = X-d; then
	echo "z" | trn
else
	echo "z" | trn >/dev/null 2>&1
fi
rm -f $TRNMACRO
echo "$0: completed"
exit 0
-- 
:s Great net resources sought...
:s Larry W. Virden                 INET: lvirden@cas.org
:s <URL:http://www.mps.ohio-state.edu/cgi-bin/hpp?lvirden_sig.html>
The task of an educator should be to irrigate the desert not clear the forest.
Re: TRN: Running it NON-interactively
#12121
Author: Peter J. Kappesser
Date: Wed, 26 Oct 1994 08:29
30 lines
2410 bytes
Recently in news.software.readers, davison@borland.com (Wayne Davison) wrote:
>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.

I happened to stop by n.s.r ready to ask about something like this, and here
it is! I tried it, and the script works great (with a few of my own hacks --
I change DOTDIR, etc. to point to an alternate .newsrc and kill files and
I extracted the lines written to the temporary macro file to a .trnmac kept
in the alternate news directory.)

But -- at this site, at least -- it refuses to run as a cron job! Works fine
while I'm logged in, but when I had cron run it with the -d (debug) option,
trn was complaining it 'Can't open /dev/tty'. (Obviously, since I'm
not on the system when it's run.)

Any ideas for a workaround, or is it some quirk of the version or the way it
was compiled here? It's trn 3.4.

My application is: I have a script which posts daily stats on the usage and
load of the computers here. I'd like each day's posting to supersede the
previous day's posting -- so I need a way to extract the Message-ID, save it
to a file, and use it for the Supersedes: line the next day. The script
worked great in test, and I could just run it from my .login, but then I'd
have to be sure to log in every day...!

	-- Pete 

--
pjkappes@mailbox.syr.edu (Peter Kappesser)
Re: TRN: Running it NON-interactively
#12154
Author: Wayne Davison
Date: Thu, 27 Oct 1994 02:13
34 lines
1677 bytes
According to Peter J. Kappesser <pjkappes@mailbox.syr.edu>:
> But [trnkill] refuses to run as a cron job [...] complaining it
> 'Can't open /dev/tty'.

This only happens on certain systems, and depends on your termio setup.
I've made a change for trn 3.6 that checks if the input is a terminal
and skips this code if it is not:

Index:term.c
@@ -149,10 +149,13 @@
     /* do no delay reads on something that always gets closed on exit */
 
-    devtty = open("/dev/tty",0);
-    if (devtty < 0) {
-	printf(cantopen,"/dev/tty") FLUSH;
-	finalize(1);
+    devtty = fileno(stdin);
+    if (isatty(devtty)) {
+	devtty = open("/dev/tty",0);
+	if (devtty < 0) {
+	    printf(cantopen,"/dev/tty") FLUSH;
+	    finalize(1);
+	}
+	fcntl(devtty,F_SETFL,O_NDELAY);
     }
-    fcntl(devtty,F_SETFL,O_NDELAY);
 #endif
 #endif

My system doesn't use this code, however, so if you'd try it out and
let me know how it goes I'd appreciate it.
-- 
Wayne Davison
davison@borland.com
Re: TRN: Running it NON-interactively
#12572
Author: R.K. Stephenson
Date: Thu, 10 Nov 1994 08:52
21 lines
1680 bytes
Peter J. Kappesser (pjkappes@hydra.syr.edu) wrote:
: Recently in news.software.readers, davison@borland.com (Wayne Davison) wrote:
: >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.

: I happened to stop by n.s.r ready to ask about something like this, and here
: it is! I tried it, and the script works great (with a few of my own hacks --

I stopped into n.s.r to ask about this - only the original post is gone.

I have a hacked copy of the trnkill script that doesn't work and was 
hoping someone could send me the original.  I can't get what I have to 
work. 

While I'm asking - does/will it work with a global kill file?  I intend 
to run it as a cron job, and would prefer to only maintain one kill file.

Thanks in advance!
R.K. Stephenson
rks@lightside.com
Re: TRN: Running it NON-interactively
#12667
Author: Wayne Davison
Date: Sat, 12 Nov 1994 00:32
44 lines
2251 bytes
According to R.K. Stephenson <rks@universe.digex.net>:
> I have a hacked copy of the trnkill script that doesn't work and was 
> hoping someone could send me the original.

Trn 3.6 will include the trnkill script as part of the distribution.
(FYI, the dying-in-cron bug that some systems have experienced is fixed
in 3.6 as well.)  I've appended the script to the end of this message
as well.

> While I'm asking - does/will it work with a global kill file?

Sure does.  You can even point trn at a custom set of kill files just
for your cron job if you like using the KILLLOCAL and KILLGLOBAL
environment variables.  It's very flexiable.
-- 
Wayne Davison
davison@borland.com
---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 <davison@borland.com>
# 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
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---
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads