[news.sysadmin] How do I NICE News Uncompressing & Unbatching

rock@rancho.uucp (Rock Kent) (02/06/89)

I'm running news, #define NEWS_VERSION   "B 2.11 4/10/87", on an
80386 machine with Sys V/386.  I receive news as compressed batches.
More specifically, I receive news as files with the header "#! cunbatch"
and would like to lower the priority of both the uncompression and
unbatching.  I'm not a C programmer and apologize in advance for any
gaffs.  

I've set NICENESS in defs.h to 10.  It looks like that sets the nice
level of the overall process when invoked in inews.c.  Does that also
apply to all processes spawned by inews?  

In particular, ifuncs.c invokes the uncompression and unbatching with
the following code segment:

>		fgets(cmd + 1, BUFLEN, infp);
>		if (strncmp(cmd, "#! cunbatch", 11) == 0) {
>			(void) sprintf(cmd, "%s/compress", LIB);
>			input_pipe(cmd, "compress", "-d", (char *) 0);
>			continue;	/* look for the #! rnews */
>		} else if (strncmp(cmd, "#! c7unbatch", 12) == 0) {
>			(void) sprintf(cmd, "%s/decode | %s/compress -d",
>				LIB, LIB);
>			input_pipe("/bin/sh", "news-unpack", "-c", cmd);
>			continue;	/* look for the #! rnews */
>		} else if (strncmp(cmd, "#! rnews ", 9) == 0 ||
>			strncmp(cmd, "! rnews ", 8) == 0) {
>			/* instead of execing unbatch do it ourselves */
>			register int fd, rc, wc;
>			int piped[2];
>			register long size, asize;
>			char *filename;
>			int pid, wpid, exstat;

Is there a straight-forward modification to the above code to ensure
that the processes which are invoked are invoked at a low priority?

Thanks for any help on this.

***************************************************************************
*Rock Kent    rock@rancho.uucp        POB 8964, Rancho Sante Fe, CA. 92067*
***************************************************************************

jiii@visdc.UUCP (John E Van Deusen III) (02/08/89)

In article <189@rancho.uucp> rock@rancho.uucp (Rock Kent) writes:
> ...
> I receive news as files with the header "#! cunbatch" and would
> like to lower the priority of both the uncompression and unbatching.

If your system becomes phlegmatic running three copies of rnews, at
200K, while simultaneously forcing compress, at 450K+, through IPC;
I have written some simple programs that solve the problem and do not
require any modifications to inews.

Prior to invoking rnews -U, files in .rnews containing #! cunbatch or
!#c7unbatch are copied to a separate file system.  (Did you ever run out
of inodes and come into work to find that all the batches had been
deleted?)  Those files are then replaced with uncompressed versions
lacking the #!c*unbatch header.  As a result, rnews does not have to
deal with running compress from a pipe.

If you want a copy of the shell script and two small C programs, just
ask.
--
John E Van Deusen III, PO Box 9283, Boise, ID  83707, (208) 343-1865

uunet!visdc!jiii