#!/bin/sh # procnews: send out and bring in our news. # Copyright 1995 John A. Phillips - john@linux.demon.co.uk # # Modified by Ivan Beveridge # for use with INN. # # usage: procnews [news_server] # Set up the defaults default_server="news.demon.co.uk" default_prefix=".demon.co.uk" slurp_tries=3 # Set the news server: # * If you don't name a news_server it defaults to $default_server # * If you give a name without a "." $default_prefix is added # * If you give a name including a "." the name is used literally news_server=${1:-${default_server}} if [ `echo $news_server | grep -Fc "."` -eq 0 ]; then news_server=${news_server}${default_prefix} fi # Send out the news we have ready to go su news -c "/usr/lib/news/bin/nntpsend >/tmp/nntpsend.log 2>&1" & # Pick up the news via slurp. slurp_result=4 while [ $slurp_result -eq 4 -a $slurp_tries -gt 0 ]; do su news -c "/usr/local/sbin/slurp -x $news_server" slurp_result=$? sleep 3 slurp_tries=`expr $slurp_tries - 1` done if [ $slurp_result -ne 0 ]; then echo slurp failed with exit code $slurp_result if [ $slurp_result -eq 4 -o $slurp_result -eq 3 ]; then exit $slurp_result fi fi # Wait for the outgoing news processes to complete if required. wait # Unbatch and store the news that came in. su news -c "/usr/lib/news/rnews -U" exit $slurp_result