[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

get-news.inn script in suck-3.3.2-1 package...



    Hello everybody!

I just installed suck-3.3.2-1 at my Debian-1.2 system and noticed that
when i upload the messages from my own newsserver to our universities
newshost using the supplied get-news.inn script i get the following error
message (look for "<--relevant part" on the right hand side):
                   ^^^^^^^^^^^^^^^^
-------------------cut-here--------------------------------------------
Processed history, 0 dupes removed
Total Articles to Download: 33
246344 Bytes Received in 1 mins 9.01 seconds, BPS = 3569.9    
Closed connection to infosys.zdv.Uni-Mainz.DE
Building Inn Batch File
Downloaded Articles
Ok
reloaded ctlinnd
Using Port 119
Official host name: infosys.zdv.Uni-Mainz.DE
Alias news.uni-mainz.de
Address: 134.93.8.129
Connected to infosys.zdv.Uni-Mainz.DE
200 news.uni-mainz.de InterNetNews NNRP server INN 1.4 22-Dec-93 ready
(posting ok).
/var/spool/news//var/spool/news/jogu/test/1 does not exist<--relevant part
Skipping Empty Article                                    ^^^^^^^^^^^^^^^^
Closing connection to infosys.zdv.Uni-Mainz.DE
Remotely posted articles
rm: /var/lib/suck/rpost.news.uni-mainz.de.6887: No such file or directory
You can hang up the modem now
Posted Articles Locally
[root]/root > cat /var/spool/news/.outgoing/news.uni-mainz.de 
[root]/root > 
------------------------cut-here------------------------------------------
And after this my /var/spool/news/.outgoing/news.uni-mainz.de is simple
gone without having posted anything which is not very nice.

The entries in /etc/suck/get-news.conf are

              server: localhost
              remoteserver: news.uni-mainz.de
              outgoingfile: news.uni-mainz.de

Now in the script /usr/sbin/get-news.inn the part in question as
follows:
------------------------cut-here------------------------------------------
# outgoing articles to post
       ${RPOST} ${REMOTE_SERVER} ${AUTHOPTS} -b ${OUTGOINGNEW} \\ c'd n.l.
       -p ${SPOOLDIR} -f \$\$o=${OUTFILE} ${SCRIPT} \$\$i ${OUTFILE}

        if [ $? -ne 0 ]; then
                echo "Error remote posting"
                exit -1;
        else
                echo "Remotely posted articles"
                rm ${OUTFILE} ${OUTGOINGNEW}
        fi
------------------------cut-here------------------------------------------

The variable "-p ${SPOOLDIR}" expands to "/var/spool/news/" and gets
prefixed to the articles numbers to be posted as stated in
/var/spool/news/.outgoing/name.of.news.site ($OUTGOING) which already
are listed there containing the full path of their location on the local
site's spool. Therefore the whole thing expands to the following name
 
     /var/spool/news//var/spool/news/group/name/article/1

for which the script just returns an error message and quits.

I've changed the part in question in /usr/sbin/get-news.inn manually:
------------------------cut-here------------------------------------------
# outgoing articles to post
       ${RPOST} ${REMOTE_SERVER} ${AUTHOPTS} -b ${OUTGOINGNEW} \\ ct'd
       -f \$\$o=${OUTFILE} ${SCRIPT} \$\$i ${OUTFILE}

        if [ $? -ne 0 ]; then
                echo "Error remote posting"   
                mv ${OUTGOINGNEW} ${OUTGOING}
        else
                echo "Remotely posted articles"
                rm ${OUTFILE} ${OUTGOINGNEW}
        fi
------------------------cut-here------------------------------------------ 

I only removed the variable "-p ${SPOOLDIR}" and changed the line after
'echo "Error remote posting"' to "mv ${OUTGOINGNEW} ${OUTGOING}" instead
of "exit -1;" so that my list of articles to be posted is preserved. 
This way it works just like a charm. Actually i had to change this stuff
manually whenever i installed suck before. The original distribution
contains exactly the same flaw.

But as it seems obviously nobody so far had any trouble with the script
like i had because i never read any complaints about this very fact on
usenet and i wonder why? Is there possibly something else wrong with my
news setup? Which would make me wonder because i strictly kept to the
Debian stuff and didn't tinker with the provided scripts. 
Any ideas someone?
                                             Regards, P. *8^)

PS: I sent a copy of this mail either to the maintainer of the original
suck distribution as well as to the maintainer of the Debian package.
Therefore i have attached the original get-news.inn under the name of
"get-news.inn.dist" and the one i have changed as "get-news.inn".
-- 
   Paul Seelig                         pseelig@goofy.zdv.uni-mainz.de
   African Music Archive - Institute for Ethnology and Africa Studies
   Johannes Gutenberg-University   -  Forum 6  -  55099 Mainz/Germany
   Our AMA Homepage  in  the WWW at  http://www.uni-mainz.de/~bender/
#!/bin/sh
# NOTE: this script needs to be run by root.
# Debian systems will not allow normal users to run ctlinnd and innxmit.
# Script distributed with suck but modified by Christophe Le Bars for the Debian package.
# authinfo compatibility by Brian Mays <brian@debian.org>.

COMMAND=$0
ETCDIR=/etc/suck			# location of sucknewsrc* and killfile*
GETNEWSCONF=${ETCDIR}/get-news.conf	# defaults for this script

if [ -z "${PAGER}" ]; then
        PAGER=more
fi

LOCAL_SERVER=`grep ^server: ${GETNEWSCONF} \
		| awk '{gsub(" ","");print}' | cut -c8-`
REMOTE_SERVER=`grep ^remoteserver: ${GETNEWSCONF} \
		| awk '{gsub(" ","");print}' | cut -c14-`
SITE=`grep ^outgoingfile: ${GETNEWSCONF} \
		| awk '{gsub(" ","");print}' | cut -c14-`
USER=`grep ^userid: ${GETNEWSCONF} \
		| awk '{gsub(" ","");print}' | cut -c8-`
PASSWD=`grep ^password: ${GETNEWSCONF} \
		| awk '{gsub(" ","");print}' | cut -c10-`

REMOTE_SERVER_DEFAULT=${REMOTE_SERVER}

if [ -z "${LOCAL_SERVER}" ]; then
        LOCAL_SERVER=localhost
fi

while [ ! -z "$1" ]; do
case "$1" in
  -outgoingfile)
                shift
                SITE_OPTION=$1
                shift
    ;;
  -server)
                shift
                LOCAL_SERVER=$1
                shift
    ;;
  -userid)
		shift
		USER=$1
		shift
    ;;
  -password)
		shift
		PASSWD=$1
		shift
    ;;
  -noauth)
		shift
		USER=""
		PASSWD=""
    ;;
  -h)
	$PAGER <<__END__
Usage:  $COMMAND [-option parm] [<sitename>]

    <sitename>		The NNTP server you will connect to.
                        (if nothing, $COMMAND read ${GETNEWSCONF})

Options:
    -outgoingfile	<filename>  	The file of your remote server
					outgoing articles.
                            		(default = the remote server name)
    -userid		<userid>	The userid to send to the remote
					server.
    -password		<password>	The password to send to the remote
					server.
    -noauth				Do not send userid and password.
					(even if they are specified in
					${GETNEWSCONF})
    -server    		<sitename>  	Your local NNTP server.
                            		(default = "$LOCAL_SERVER")
__END__
	exit 0
    ;;
  *)
                REMOTE_SERVER=$1
                shift
    ;;
esac
done

if [ -z "${SITE}" ]; then
        SITE=${REMOTE_SERVER}
fi

if [ ! "${REMOTE_SERVER_DEFAULT}" = "${REMOTE_SERVER}" ]; then
        SITE=${REMOTE_SERVER}
fi

if [ ! -z "${SITE_OPTION}" ]; then
        SITE=${SITE_OPTION}
fi

if [ ! -z "${USER}" ]; then
        AUTHOPTS="-U ${USER}"
else
        AUTHOPTS=""	
fi
if [ ! -z "${PASSWD}" ]; then
        AUTHOPTS="$AUTHOPTS -P ${PASSWD}"
fi

BINDIR=/usr/bin				# base directory for suck rpost and testhost
SBINDIR=/usr/sbin			# base directory for scripts
NEWSDIR=/usr/lib/news			# base directory for news binaries 
SPOOLDIR=/var/spool/news		# base directory for articles to be rposted

OUTGOING=${SPOOLDIR}/.outgoing/${SITE}	# location of the list of articles to upload
OUTGOINGNEW=${OUTGOING}.new		# temporarily used during upload of articles

INNXMIT=${NEWSDIR}/bin/innxmit		# location of INNXMIT
CTLINND=${NEWSDIR}/bin/ctlinnd		# location of CTLINND

SUCKDIR=/var/lib/suck				# location for suck files
LASTDIR=${SUCKDIR}/last.${REMOTE_SERVER}	# last get-news suck files
MSGDIR=${SUCKDIR}/msg.${REMOTE_SERVER}		# where to put MultiFile articles when getting them
OUTFILE=${SUCKDIR}/rpost.${REMOTE_SERVER}.$$	# used by rpost as article after it is filtered
BATCHFILE=${SUCKDIR}/batch.${REMOTE_SERVER}.$$	# Name of batchfile to build for rnews or innxmit

RPOST=${BINDIR}/rpost			# my rpost
SUCK=${BINDIR}/suck			# my suck
TESTHOST=${BINDIR}/testhost		# my testhost
SCRIPT=${SBINDIR}/put-news		# my filter for rpost

# is the local host up and running so we can post articles we download?
${TESTHOST} ${LOCAL_SERVER} -s -e
LOCAL_RESULT=$?
if [ ${LOCAL_RESULT} -ne 0 ]; then
	echo "Bad status for the ${LOCAL_SERVER} local NNTP news server"
	exit 1
fi

# is the remote host up and running so we can download articles?
${TESTHOST} ${REMOTE_SERVER} -s -e
REMOTE_RESULT=$?
if [ ${REMOTE_RESULT} -ne 0 ]; then
	echo "Bad status for the ${REMOTE_SERVER} remote NNTP news server"
	exit 2
fi

[ -d ${LASTDIR} ] || mkdir ${LASTDIR}

if [ "${REMOTE_SERVER_DEFAULT}" = "${REMOTE_SERVER}" ]; then
	# download articles with the default remote server
	${SUCK} ${REMOTE_SERVER} ${AUTHOPTS} -bi ${BATCHFILE} -dt ${SUCKDIR} -dm ${MSGDIR} -dd ${ETCDIR}
	SUCK_STATUS=$?
	if [ ${SUCK_STATUS} -eq 0 ]; then
		echo "Downloaded Articles"
		mv ${ETCDIR}/sucknewsrc ${ETCDIR}/sucknewsrc.old
		mv ${SUCKDIR}/suck.newrc ${ETCDIR}/sucknewsrc
		mv ${SUCKDIR}/suck.sorted ${LASTDIR}
		if [ -f ${SUCKDIR}/suck.killlog ]; then	
			mv ${SUCKDIR}/suck.killlog ${LASTDIR}
		fi
		if [ -f ${ETCDIR}/suckothermsgs ]; then
			mv ${ETCDIR}/suckothermsgs ${LASTDIR}
		fi
	fi
else
	# download articles
	${SUCK} ${REMOTE_SERVER} ${AUTHOPTS} -bi ${BATCHFILE} -dt ${SUCKDIR} -dm ${MSGDIR} -dd ${ETCDIR} -p .${REMOTE_SERVER}
	SUCK_STATUS=$?
	if [ ${SUCK_STATUS} -eq 0 ]; then
		echo "Downloaded Articles"
		mv ${ETCDIR}/sucknewsrc.${REMOTE_SERVER} ${ETCDIR}/sucknewsrc.${REMOTE_SERVER}.old
		mv ${SUCKDIR}/suck.newrc.${REMOTE_SERVER} ${ETCDIR}/sucknewsrc.${REMOTE_SERVER}
		mv ${SUCKDIR}/suck.*.${REMOTE_SERVER} ${LASTDIR}
		if [ -f ${ETCDIR}/suckothermsgs.${REMOTE_SERVER} ]; then
			mv ${ETCDIR}/suckothermsgs.${REMOTE_SERVER} ${LASTDIR}
		fi
	fi
fi


# now upload articles
if [ -s ${OUTGOING} ]; then

	# this is needed by INND so that the outgoing file will be
	# properly flushed and we have a new blank file to work with
	# when we are done
	# First mv the current one to a new file name
	# Since innd already has the file open, it doesn't care 
	# about the rename.
	# The flush will ensure that all articles to be posted have
	# been written out, close off the old one (already renamed)
	# and create a new one.
	mv ${OUTGOING} ${OUTGOINGNEW}

	${CTLINND} flush ${SITE}
	echo "reloaded ctlinnd"

	# outgoing articles to post
	${RPOST} ${REMOTE_SERVER} ${AUTHOPTS} -b ${OUTGOINGNEW} -f \$\$o=${OUTFILE} ${SCRIPT} \$\$i ${OUTFILE}

	if [ $? -ne 0 ]; then
		echo "Error remote posting!Try again later!"
		mv ${OUTGOINGNEW} ${OUTGOING}
	else
		echo "Remotely posted articles"
		rm ${OUTFILE} ${OUTGOINGNEW}
	fi
fi	
	
echo "You can hang up the modem now"

if [ -f ${BATCHFILE} ]; then	
	# locally post articles
	${INNXMIT} ${LOCAL_SERVER} ${BATCHFILE}

	if [ $? -ne 0 ]; then
		echo "Local posting error"
		exit -1;
	else
		echo "Posted Articles Locally"
		rm -rf ${MSGDIR}
	fi	
fi	

#!/bin/sh
# NOTE: this script needs to be run by root.
# Debian systems will not allow normal users to run ctlinnd and innxmit.
# Script distributed with suck but modified by Christophe Le Bars for the Debian package.
# authinfo compatibility by Brian Mays <brian@debian.org>.

COMMAND=$0
ETCDIR=/etc/suck			# location of sucknewsrc* and killfile*
GETNEWSCONF=${ETCDIR}/get-news.conf	# defaults for this script

if [ -z "${PAGER}" ]; then
        PAGER=more
fi

LOCAL_SERVER=`grep ^server: ${GETNEWSCONF} \
		| awk '{gsub(" ","");print}' | cut -c8-`
REMOTE_SERVER=`grep ^remoteserver: ${GETNEWSCONF} \
		| awk '{gsub(" ","");print}' | cut -c14-`
SITE=`grep ^outgoingfile: ${GETNEWSCONF} \
		| awk '{gsub(" ","");print}' | cut -c14-`
USER=`grep ^userid: ${GETNEWSCONF} \
		| awk '{gsub(" ","");print}' | cut -c8-`
PASSWD=`grep ^password: ${GETNEWSCONF} \
		| awk '{gsub(" ","");print}' | cut -c10-`

REMOTE_SERVER_DEFAULT=${REMOTE_SERVER}

if [ -z "${LOCAL_SERVER}" ]; then
        LOCAL_SERVER=localhost
fi

while [ ! -z "$1" ]; do
case "$1" in
  -outgoingfile)
                shift
                SITE_OPTION=$1
                shift
    ;;
  -server)
                shift
                LOCAL_SERVER=$1
                shift
    ;;
  -userid)
		shift
		USER=$1
		shift
    ;;
  -password)
		shift
		PASSWD=$1
		shift
    ;;
  -noauth)
		shift
		USER=""
		PASSWD=""
    ;;
  -h)
	$PAGER <<__END__
Usage:  $COMMAND [-option parm] [<sitename>]

    <sitename>		The NNTP server you will connect to.
                        (if nothing, $COMMAND read ${GETNEWSCONF})

Options:
    -outgoingfile	<filename>  	The file of your remote server
					outgoing articles.
                            		(default = the remote server name)
    -userid		<userid>	The userid to send to the remote
					server.
    -password		<password>	The password to send to the remote
					server.
    -noauth				Do not send userid and password.
					(even if they are specified in
					${GETNEWSCONF})
    -server    		<sitename>  	Your local NNTP server.
                            		(default = "$LOCAL_SERVER")
__END__
	exit 0
    ;;
  *)
                REMOTE_SERVER=$1
                shift
    ;;
esac
done

if [ -z "${SITE}" ]; then
        SITE=${REMOTE_SERVER}
fi

if [ ! "${REMOTE_SERVER_DEFAULT}" = "${REMOTE_SERVER}" ]; then
        SITE=${REMOTE_SERVER}
fi

if [ ! -z "${SITE_OPTION}" ]; then
        SITE=${SITE_OPTION}
fi

if [ ! -z "${USER}" ]; then
        AUTHOPTS="-U ${USER}"
else
        AUTHOPTS=""	
fi
if [ ! -z "${PASSWD}" ]; then
        AUTHOPTS="$AUTHOPTS -P ${PASSWD}"
fi

BINDIR=/usr/bin				# base directory for suck rpost and testhost
SBINDIR=/usr/sbin			# base directory for scripts
NEWSDIR=/usr/lib/news			# base directory for news binaries 
SPOOLDIR=/var/spool/news		# base directory for articles to be rposted

OUTGOING=${SPOOLDIR}/.outgoing/${SITE}	# location of the list of articles to upload
OUTGOINGNEW=${OUTGOING}.new		# temporarily used during upload of articles

INNXMIT=${NEWSDIR}/bin/innxmit		# location of INNXMIT
CTLINND=${NEWSDIR}/bin/ctlinnd		# location of CTLINND

SUCKDIR=/var/lib/suck				# location for suck files
LASTDIR=${SUCKDIR}/last.${REMOTE_SERVER}	# last get-news suck files
MSGDIR=${SUCKDIR}/msg.${REMOTE_SERVER}		# where to put MultiFile articles when getting them
OUTFILE=${SUCKDIR}/rpost.${REMOTE_SERVER}.$$	# used by rpost as article after it is filtered
BATCHFILE=${SUCKDIR}/batch.${REMOTE_SERVER}.$$	# Name of batchfile to build for rnews or innxmit

RPOST=${BINDIR}/rpost			# my rpost
SUCK=${BINDIR}/suck			# my suck
TESTHOST=${BINDIR}/testhost		# my testhost
SCRIPT=${SBINDIR}/put-news		# my filter for rpost

# is the local host up and running so we can post articles we download?
${TESTHOST} ${LOCAL_SERVER} -s -e
LOCAL_RESULT=$?
if [ ${LOCAL_RESULT} -ne 0 ]; then
	echo "Bad status for the ${LOCAL_SERVER} local NNTP news server"
	exit 1
fi

# is the remote host up and running so we can download articles?
${TESTHOST} ${REMOTE_SERVER} -s -e
REMOTE_RESULT=$?
if [ ${REMOTE_RESULT} -ne 0 ]; then
	echo "Bad status for the ${REMOTE_SERVER} remote NNTP news server"
	exit 2
fi

[ -d ${LASTDIR} ] || mkdir ${LASTDIR}

if [ "${REMOTE_SERVER_DEFAULT}" = "${REMOTE_SERVER}" ]; then
	# download articles with the default remote server
	${SUCK} ${REMOTE_SERVER} ${AUTHOPTS} -bi ${BATCHFILE} -dt ${SUCKDIR} -dm ${MSGDIR} -dd ${ETCDIR}
	SUCK_STATUS=$?
	if [ ${SUCK_STATUS} -eq 0 ]; then
		echo "Downloaded Articles"
		mv ${ETCDIR}/sucknewsrc ${ETCDIR}/sucknewsrc.old
		mv ${SUCKDIR}/suck.newrc ${ETCDIR}/sucknewsrc
		mv ${SUCKDIR}/suck.sorted ${LASTDIR}
		if [ -f ${SUCKDIR}/suck.killlog ]; then	
			mv ${SUCKDIR}/suck.killlog ${LASTDIR}
		fi
		if [ -f ${ETCDIR}/suckothermsgs ]; then
			mv ${ETCDIR}/suckothermsgs ${LASTDIR}
		fi
	fi
else
	# download articles
	${SUCK} ${REMOTE_SERVER} ${AUTHOPTS} -bi ${BATCHFILE} -dt ${SUCKDIR} -dm ${MSGDIR} -dd ${ETCDIR} -p .${REMOTE_SERVER}
	SUCK_STATUS=$?
	if [ ${SUCK_STATUS} -eq 0 ]; then
		echo "Downloaded Articles"
		mv ${ETCDIR}/sucknewsrc.${REMOTE_SERVER} ${ETCDIR}/sucknewsrc.${REMOTE_SERVER}.old
		mv ${SUCKDIR}/suck.newrc.${REMOTE_SERVER} ${ETCDIR}/sucknewsrc.${REMOTE_SERVER}
		mv ${SUCKDIR}/suck.*.${REMOTE_SERVER} ${LASTDIR}
		if [ -f ${ETCDIR}/suckothermsgs.${REMOTE_SERVER} ]; then
			mv ${ETCDIR}/suckothermsgs.${REMOTE_SERVER} ${LASTDIR}
		fi
	fi
fi


# now upload articles
if [ -s ${OUTGOING} ]; then

	# this is needed by INND so that the outgoing file will be
	# properly flushed and we have a new blank file to work with
	# when we are done
	# First mv the current one to a new file name
	# Since innd already has the file open, it doesn't care 
	# about the rename.
	# The flush will ensure that all articles to be posted have
	# been written out, close off the old one (already renamed)
	# and create a new one.
	mv ${OUTGOING} ${OUTGOINGNEW}

	${CTLINND} flush ${SITE}
	echo "reloaded ctlinnd"

	# outgoing articles to post
	${RPOST} ${REMOTE_SERVER} ${AUTHOPTS} -b ${OUTGOINGNEW} -p ${SPOOLDIR} -f \$\$o=${OUTFILE} ${SCRIPT} \$\$i ${OUTFILE}

	if [ $? -ne 0 ]; then
		echo "Error remote posting"
		exit -1;
	else
		echo "Remotely posted articles"
		rm ${OUTFILE} ${OUTGOINGNEW}
	fi
fi	
	
echo "You can hang up the modem now"

if [ -f ${BATCHFILE} ]; then	
	# locally post articles
	${INNXMIT} ${LOCAL_SERVER} ${BATCHFILE}

	if [ $? -ne 0 ]; then
		echo "Local posting error"
		exit -1;
	else
		echo "Posted Articles Locally"
		rm -rf ${MSGDIR}
	fi	
fi	


Reply to: