⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 suck_040225.shar

📁 Suck Wrappers are a set of UNIX script files that sets up inn, an NNTP server, on a local machine so
💻 SHAR
📖 第 1 页 / 共 5 页
字号:
X	  have found the one which returns the values used by the versionX	  of innd, enter the following commands BEFORE running $SN:X	    PATHBIN=/dir_path_to_innconfval ;export PATHBINX	    ls -l $PATHBIN/innconfval $PATHBIN/ctlinnd $PATHBIN/shlockX	      This should list three executable files if it does not thenX	      the problem is beyond this script to help.X	    $SNX	_EOBXX	rm -f /tmp/$SN.1.$$X	exit 1;;1 )X	REMOTE_FQDN=${REMOTE_FQDN:=`cat /tmp/$SN.1.$$`};;* )X	if [ -z "$REMOTE_FQDN" ]X	thenX		cat <<- _EOBX			There is a problem there is more than one name which canX			be used as an exclusion: X		_EOBX		cat /tmp/$SN.1.$$ X		read $REMOTE_FQDNX		set_env_fn "" "Please enter the REMOTE_FQDN name <rtn> or <rtn> to abort: "X		REMOTE_FQDN=$EnvTmpX		if [ "$REMOTE_FQDN" == "" ]X		thenX			echo "ERROR:$SN:main:140:REMOTE_FQDN not set --  bailing out" 1>&2 X			rm -f /tmp/$SN.1.$$X			exit 1X		fiX	fi;;esacXprint_fn The remote identifier string is REMOTE_FQDN=$REMOTE_FQDNrm -f /tmp/$SN.1.$$X################################################################## print_fn "modifying the $PATHETC/newsfeeds"###########grep $NNTPSERVER -s $PATHETC/newsfeeds >/dev/nullcase $? in 1 )X	#X	## no match append it on the bottom of the fileX	#X	if [ ! -f $PATHETC/newsfeeds.$Org ]X	thenX		cp -p $PATHETC/newsfeeds $PATHETC/newsfeeds.$OrgX	elseX		echo "WARNING:$SN:main:150:$PATHETC/newsfeeds.$Org exists"  1>&2X	ficat >> $PATHETC/newsfeeds << _EOBX### added by news $HOME/suck/setup_suck.sh## ISP_server/isp_FQDN #$NNTPSERVER/${REMOTE_FQDN}\\X	:*,!control*,!junk,!local*\\X	::X_EOB;;	2 )X	echo "ERROR:$SN:main:160:grep $PATHDB/newsfeeds  failed -- bailing out" 1>&2X	exit 1;;esacSHAR_EOF  (set 20 03 11 07 21 30 11 'suck/setup_suck.sh'; eval "$shar_touch") &&  chmod 0554 'suck/setup_suck.sh' ||  $echo 'restore of' 'suck/setup_suck.sh' 'failed'  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then    md5sum -c << SHAR_EOF >/dev/null 2>&1 \    || $echo 'suck/setup_suck.sh:' 'MD5 check failed'5e36ec085721bcc101977dd22af55d27  suck/setup_suck.shSHAR_EOF  else    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'suck/setup_suck.sh'`"    test 20890 -eq "$shar_count" ||    $echo 'suck/setup_suck.sh:' 'original size' '20890,' 'current size' "$shar_count!"  fifi# ============= suck/get.news.inn ==============if test -f 'suck/get.news.inn' && test "$first_param" != -c; then  $echo 'x -' SKIPPING 'suck/get.news.inn' '(file already exists)'else  $echo 'x -' extracting 'suck/get.news.inn' '(text)'  sed 's/^X//' << 'SHAR_EOF' > 'suck/get.news.inn' &&#!/bin/sh ######################################################################### @(#)get.news.inn Version: 1.7 Date: 04/02/25 14:51:27## AUTHOR VERSION INFORMATION AND CONTACT DETAILS#    Original source at: http://www.sucknews.org##    This script was modified by Philip Shearer ( lmrlnATbigfoot.com#    replace AT with @). I am not sure who the original author was#    because no information was given at the top of the original file.##BEFORE USING - check to ensure all the paths defined below are correct!!#They are available for inspection and alteration in $HOME/.suckenvrc##NOTE: this script will be run by user  news (or maybe root)########################################################################Xif [ -f $HOME/.suckenvrc ]thenX.	$HOME/.suckenvrcfiX########################################################################all_env_set_fn(){set  \X	"$NNTPSERVER" \X	"$LOCALHOST" \X	"$NEWSFEED" \X	"$NET_ENQUIRE" \X	\X	"$PATHBIN" \X	"$PATHARTICLES" \X	"$PATHOUTGOING" \X	"$PATHTMP" \X	\X	"$INN_HIST" \X	"$PATHSUCK" \X	\X	"$SUCK_CONF" \X	"$RPOST_CONF" \X	"$PUT_SED_HEAD_CMDS" \X	"$PUT_SED_BODY_CMDS"Xwhile [ "$1" ]doX	shiftX	if [ $# -eq 0 ]X	thenX		return 0X	fidoneXreturn $#}########################################################################display_env_fn(){cat 1>&2 <<-EOB X	$BN:ERROR:environment variables not all set where is $HOME/.suckenvrc?X	        NNTPSERVER=${NNTPSERVER}	# where to get/send newsX	        LOCALHOST=${LOCALHOST}		# usually localhostX	        NEWSFEED=${NEWSFEED}		# value "inn" newsfeed fileXX		#X		## These should be the same as the values in inn.conf X		#X	        PATHBIN=${PATHBIN}	# dir of news binariesX	        PATHARTICLES=${PATHARTICLES}		# base directory for articlesX	        PATHOUTGOING=${PATHOUTGOING}	# base directory for list of outgoing articlesX	        PATHTMP=${PATHTMP}	# /tmp is insecure XX		# should be the same as inn.conf "pathdb"/historyX	        INN_HIST=${INN_HIST}		# path to history fileX	        PATHSUCK=${SUCKPATH}		# base directory for suck scripts and data filesXX 	        SUCK_CONF=${SUCK_CONF}		# name of the suck configuration fileX		RPOST_CONF=${RPOST_CONF}	# name of the rpost configuration fileXX		#X		## The following are a sed script used by put.news.smX		#X	        PUT_SED_HEAD_CMDS=${PUT_SED_HEAD_CMDS} # used by sed to strip out certain headersX	        PUT_SED_BODY_CMDS=${PUT_SED_BODY_CMDS} # sed to skip the body of the messageXX		#X		## To get debug output set his variableX		#X	        # SUCK_DEBUG="-D" ; export SUCK_DEBUG X	        SUCK_DEBUG=$SUCK_DEBUGEOB}########################################################################usage_fn(){X	echo "usage $BN: [-n[ntperver] name]"X	exit 0}#########################################################################main######BN=`basename $0`case $# in0 );;2 )X	##############################################################X	# The -n switch allows for multiple nntp server connectionsX	# Just copy the $SUCK_CONF to the same name with the NNTPX	# server as the extension.X	# An additional line needs to be put into the fileX	# $SUCK_CONF.news.server.comX	#   -p news.server.comX	# where "news.server.com" is the DNS Internet address of the newsX	# server you wish to connect too.X	#X	# The suck manual entry saysX	#  If  you  use the -p (postfix) option, suck will check for theX	#  existence of an active-ignore file with the postfix.  If  thatX	#  doesn't exist,  then  suck will check for the existence ofX	#  the file without the postfix.X	#X	# Set up the files as described above and run the commandX	# get.news.inn -n news.server.comX	#############################################################X	case $1 inX	-[nN]* )X		NNTPSERVER=$2X		NEWSFEED=$NNTPSERVERX		SUCK_CONF=$SUCK_CONF.$NNTPSERVERX		export NEWSFEED NNTPSERVER SUCK_CONFX	;;X 	* )X		usage_fnX	;;X	esac;;* ) X		usage_fn;;esacXall_env_set_fn if [ $? -ne 0 ]thenX	display_env_fnX	exit 1fiXif [ ! -z "$SUCK_DEBUG" ]  && [ $SUCK_DEBUG != "-D" ]thenX	echo "$BN:ERROR:SUCK_DEBUG must be set to SUCK_DEBUG='-D' --bailing out" 1>&2X	exit 1fiXCTLINND=${PATHBIN}/ctlinnd		# location of binarySHLOCK=${PATHBIN}/shlock		# location of binaryXSITE=${NEWSFEED}XOUTGOING=${PATHOUTGOING}/${SITE}	# location of the list of articles to uploadOUTGOINGNEW=${OUTGOING}.new		# file to contain the list temporarilyOUTGOINGFAIL=${OUTGOINGNEW}.fail	# file with failed xfersXOUTFILE=$PATHTMP/${BN}_$$		# used by rpost as article after it is filteredLOCKFILE=${PATHSUCK}/getnews.lock	# lock file to prevent multiple instances of scriptNEWSGROUP=news				# group of the files in in outgoing, typically either news or uucp.XTESTHOST=testhostRPOST=rpostSUCK=suckXexport OUTGOING OUTGOINGNEW OUTGOINGFAIL OUTFILE LOCKFILE NEWSGROUPX# if we are already running, abort Xtrap 'rm -f ${LOCKFILE} ; echo "Aborting" ; exit 1' 1 2 3 15${SHLOCK} -p $$ -f ${LOCKFILE}if [ $? -ne 0 ]; thenX	echo "Already running, can't run two at one time"X	exitfiX#Is the NNTPSERVER availableeval $NET_ENQUIRE $NNTPSERVERX#is the local host up and running so we can post messages we download?${TESTHOST} ${LOCALHOST} -sLOCAL_RESULT=$?X# is the remote host up and running so we can download messages?${TESTHOST} ${NNTPSERVER} -sREMOTE_RESULT=$?Xif [ ${REMOTE_RESULT} -eq 0 -a ${LOCAL_RESULT} -eq 0 ]; thenX	X	# download messagesX	eval ${SUCK} ${NNTPSERVER} `sed '/^#/d' $SUCK_CONF`X	SUCK_STATUS=$?XX	if [ ${SUCK_STATUS} -eq 0 ]; thenX		echo "Downloaded Articles"X	elif [ ${SUCK_STATUS} -eq 1 ]; thenX		echo "No articles to download"X	elif [ ${SUCK_STATUS} -eq 2 ]; thenX		echo "Unexpected answer from remote server to an issued command"X	elif [ ${SUCK_STATUS} -eq 4 ]; thenX		echo "Can't do NNTP authorization"X	elif [ ${SUCK_STATUS} -eq -1 ]; thenX		echo "General failure"X	fiXX	# now upload messagesX	if [ -s ${OUTGOING}  -o -s ${OUTGOINGNEW} ]; thenXX		${TESTHOST} ${NNTPSERVER} -sXX		if [ $? -ne 0 ]; thenX			echo "Remote posting host not responding"X		elseX			# OUTGOING is needed by INND so that the outgoingX			# file will be properly flushed and we have aX			# new blank file to work with when we are done:X			#X			# First mv the current one to a new file nameX			# Since innd already has the file open, it doesn't care X			# about the rename.X			# The flush will ensure that all messages to be posted haveX			# been written out, close off the old one (already renamed)X			# and create a new one.XX			if [ ! -s ${OUTGOINGNEW} ]; thenX				  # If the OUTGOINGNEW does not exist thenX				  # because of the previous test OUTGOINGX				  # must exist and is not empty. So moveX				  # OUTGOING to to OUTGOINGNEW and useX				  # ctlind flush to recreate OUTGOING.X				mv ${OUTGOING} ${OUTGOINGNEW}X				${CTLINND} flush ${SITE}X			elseX				if [ -s ${OUTGOING} ]X				thenX					# There is an outgoing file from last time andX					# one from this time. So as there is somthing wrongX					# with the previous. By using rev which reverses theX					# file order. The show stopper from last time will moveX					# to the bottom of the file. X					# WARNING if more than one article fails there may be X					# good ones trapped between the failuresXX					X					mv ${OUTGOINGNEW} ${OUTGOINGNEW}.$$X					mv ${OUTGOING} ${OUTGOINGNEW}X					${CTLINND} flush ${SITE}X					sort -r  ${OUTGOINGNEW}.$$ >>${OUTGOINGNEW}X					rm -f ${OUTGOINGNEW}.$$X				fiX			fiXX			article="articles"X			msglines=`wc -l ${OUTGOINGNEW} | sed -e 's/ [^0-9| ].*//' -e 's/ //g'`X			if [ $msglines -eq 1 ]X			thenX				article="article"X			fiX			X			d=`date +"%y/%m/%d %X"`X			echo $msglines outgoing $article to post to ${NNTPSERVER}:X			sed "s;^;$d Trying to post ;" ${OUTGOINGNEW}X			eval ${RPOST} ${NNTPSERVER}  `sed '/^#/d' $RPOST_CONF`X			ERRLEV=$?X			case $ERRLEV inX			0 )X				echo "Remotely posted" $msglines $article "to" ${NNTPSERVER}X				rm ${OUTFILE}X			;;X			1 )X				echo "Error remotely posting to " ${NNTPSERVER} $msglines $articleX			;;X			2 )X				echo "Unable to do NNTP authorization with remote server ${NNTPSERVER}"X			;;X			3 )X				echo "Unexpected answer from remote server ${NNTPSERVER} to a command while doing NNTP authorization"X			;;X			-1 )X				echo "Fatal error remote posting to ${NNTPSERVER}"X			;;X			* )X				echo "Unknown error: ${ERRLEV} remote posting to ${NNTPSERVER}"X			;;X			esacXX			if [ -f ${OUTGOINGFAIL} ]; thenX				mv ${OUTGOINGFAIL} ${OUTGOINGNEW}	# so we can re do itX				chown news:${NEWSGROUP} ${OUTGOINGNEW}X				chmod 664 ${OUTGOINGNEW}X			fiX		fiX	fi	X	X	d=`date +"%y/%m/%d %X"`X	echo "You can hang up the modem now. $d"XfiXrm -f ${LOCKFILE}SHAR_EOF  (set 20 04 02 25 14 51 27 'suck/get.news.inn'; eval "$shar_touch") &&  chmod 0554 'suck/get.news.inn' ||  $echo 'restore of' 'suck/get.news.inn' 'failed'  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then    md5sum -c << SHAR_EOF >/dev/null 2>&1 \    || $echo 'suck/get.news.inn:' 'MD5 check failed'd67a11367a965f293d34f8b8c6ab64a6  suck/get.news.innSHAR_EOF  else    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'suck/get.news.inn'`"    test 8595 -eq "$shar_count" ||    $echo 'suck/get.news.inn:' 'original size' '8595,' 'current size' "$shar_count!"  fifi# ============= suck/suck.conf ==============if test -f 'suck/suck.conf' && test "$first_param" != -c; then  $echo 'x -' SKIPPING 'suck/suck.conf' '(file already exists)'else  $echo 'x -' extracting 'suck/suck.conf' '(text)'  sed 's/^X//' << 'SHAR_EOF' > 'suck/suck.conf' &&############################################################################# @(#)suck.conf Version: 1.1 Date: 03/06/05 22:48:13  Author: PBS# To contact the Author: lmrlnATbigfoot.com replace AT with @# Copyright (C) 2003 Philip Baird Shearer## This program is free software; you can redistribute it and/o

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -