Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mcnc!rti!xyzzy!meissner From: meissner@xyzzy.UUCP Newsgroups: news.admin Subject: Re: NFS news - problem ?? Message-ID: <286@xyzzy.UUCP> Date: Wed, 30-Sep-87 11:34:40 EDT Article-I.D.: xyzzy.286 Posted: Wed Sep 30 11:34:40 1987 Date-Received: Fri, 2-Oct-87 03:32:30 EDT References: <1396@osiris.UUCP> <7365@g.ms.uky.edu> Reply-To: meissner@nightmare.UUCP (Michael Meissner) Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 116 In article <7365@g.ms.uky.edu> david@ms.uky.edu (David Herron -- Resident E-mail Hack) writes: > In article <1396@osiris.UUCP> mjr@osiris.UUCP (Marcus J. Ranum) writes: > > Is there any reason why one system, that supports spooled > >news files, can't export /usr/spool/news to other systems under > >NFS ? Since nothing would be changed, it seems to be that the only > >hacks needed would be to postnews, rather than vnews. Have I overlooked > >something obvious ? > > What hacks? You just do it ... > > don't forget to export /usr/lib/news also. We do this at Data General, and there are a few gotcha's, nits, etc: 1) The news software executables live in the same directory as the databases (/usr/lib/news). If you have multiple CPU architectures (like say some Suns and a VAX), you may want/need to put the executables elsewhere and use symlinks and/or mount to get the right machine to execute the correct executable. 2) You have to decide how posting will be done (ie, will the machine name that the user posts to get put into the From/Path headers, or do you restrict posting to the master machine). At DG, I hacked inews (which the posting agents call) to do a gethostname, and if the machine is not the master host, it spawns an rsh to execute inews on the master machine do the posting. For example, I am currently posting this article from a machine "nightmare", but when inews is spawned, it will really post it on the machine "xyzzy" which is our net connection. If you have the clients post on their own machines, you get into some nasty problems such as: 1) you have to make sure flock/lockf works transparently on all machines for NFS disks, or you have to go back to the V7 way of locking the active file (with links); 2) You might see double postings, since the master machine is not in the Path header. I have put the relavant code for this at the end of the article. 3) You also have to make sure Reply's work as well (ie, configuring the client sendmail's to handle the addresses given it). 4) Rn really go crazy and damages the .newsrc file if you have the file system /usr/lib/news soft mounted, and the server is down. It also doesn't handle the case too well if the server dies in the middle, and it gets errors reading the active file (though after a few newsgroups it does figure something is wrong and restores the active file). To add my changes for rsh, add a line to defs.h with localize of the form: #define NFS_MASTER "xyzzy" /* machine to post news on */ And then add the following lines to inews.c after it closes the extra file descriptors because of uuxqt brain damage: #ifdef NFS_MASTER { /* Is this on a remote NFS system? */ char buf[256]; char **new_argv, **p; int pid, i; int status, (*hstat)(), (*istat)(), (*qstat)(); if( gethostname( buf, sizeof(buf) ) == 0 && strcmp( NFS_MASTER, buf ) != 0 ){ if( isatty(1) ) printf("Spawning inews on %s\n", NFS_MASTER); p = new_argv = (char **) malloc( sizeof(char *) * (argc+4)); strcpy(buf, LIBDIR); strcat(buf, "/inews"); argv++; *p++ = "rsh"; *p++ = NFS_MASTER; *p++ = buf; while( (*p++ = *argv++) != (char *)0 ) ; pid = vfork(); if( pid == 0 ){ /* child */ execv( "/usr/bin/rsh", new_argv ); perror( "/usr/bin/rsh" ); _exit( 127 ); } else if( pid > 0 ){ /* parent */ istat = signal(SIGINT, SIG_IGN); qstat = signal(SIGQUIT, SIG_IGN); hstat = signal(SIGHUP, SIG_IGN); while( (i = wait(&status)) != pid && i != -1 ) ; (void) signal(SIGINT, istat); (void) signal(SIGQUIT, qstat); (void) signal(SIGHUP, hstat); printf("Done with remote sh\n"); exit( status >> 8 ); } else { perror( "vfork error" ); exit( 1 ); } } } #endif -- Michael Meissner, Data General. Uucp: ...!mcnc!rti!xyzzy!meissner Arpa/Csnet: meissner@dg-rtp.DG.COM