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

📄 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	"$PATHARTICLES" \X	"$PATHOUTGOING" \X	"$PATHDB" \X	"$PATHTMP"XX	while [ $1 ]X	doX		shiftX		if [ $# -eq 0 ]X		thenX			return 0X		fiX	doneXX	return $#}################################################################################display_innconf_fn(){Xcat << _EOBX	        PATHBIN=$PATHBINX	        PATHARTICLES=$PATHARTICLESX	        PATHOUTGOING=$PATHOUTGOINGX	        PATHDB=$PATHDBX	        PATHTMP=$PATHTMP_EOB}################################################################################create_suckenvrc_fn() {if [ -f $HOME/suck/$SuckEnvRc ]thenX	if [ ! -f $HOME/suck/$SuckEnvRc.$Org ]X	thenX		cp -p $HOME/suck/$SuckEnvRc $HOME/suck/$SuckEnvRc.$OrgX	fificat>$HOME/suck/$SuckEnvRc <<- _EOBX X	NNTPSERVER=\${NNTPSERVER:=$NNTPSERVER}	# where to get/send news X	LOCALHOST=\${LOCALHOST:=$LOCALHOST}	# usually localhost X	NEWSFEED=\${NEWSFEED:=\$NNTPSERVER} 	# value "inn" newsfeed fileX	NET_ENQUIRE=\${NET_ENQUIRE:="${HostCmd}"} #give a dialup line time to come upX	export NNTPSERVER LOCALHOST NEWSFEED NET_ENQUIREXX	#X	## Theses values were generated from the $INN_CONF if the valuesX	## of inn.conf are changed so should these ether do it by hand,X	## re-run the "$HOME/suck/$SN" scriptX	##X	## or the can be accessed uncommenting the next two linesX	#  innconfval -s >$HOME/.innconfvalX	#  . $HOME/.innconfval X	PATHBIN=\${PATHBIN:=$PATHBIN}	# dir of news binariesX	PATHARTICLES=\${PATHARTICLES:=$PATHARTICLES} # base directory for articlesX	PATHOUTGOING=\${PATHOUTGOING:=$PATHOUTGOING} # base directory for list of outgoing articlesX	PATHDB=\${PATHDB:=$PATHDB}	X	PATHTMP=\${PATHTMP:=$PATHTMP}	# secure tmp dirX	export PATHBIN PATHARTICLES PATHOUTGOING PATHDB PATHTMPXX	INN_HIST=\${INN_HIST:=\$PATHDB/history} # path to history file X	PATHSUCK=\${PATHSUCK:=$HOME/suck}	# base directory for suck scripts and data files XX	SUCK_CONF=\${SUCK_CONF:=\$PATHSUCK/suck.conf}	# suck configuration fileX	RPOST_CONF=\${RPOST_CONF:=\$PATHSUCK/rpost.sm.conf}	# rpost configuration file with sm filterXX	export INN_HIST PATHSUCK SUCK_CONF RPOST_CONFXX	#X	## used by put.news.sm (also use PATHTMP)X	## The following are two parts of a sed scriptX	## PUT_SED_HEAD_CMDS used by sed to strip out certain header linesX	## PUT_SED_BODY_CMDS used by sed to skip the body of the messageX	#X	PUT_SED_HEAD_CMDS=\${PUT_SED_HEAD_CMDS:=\$PATHSUCK/put.news.head.conf}X	PUT_SED_BODY_CMDS=\${PUT_SED_BODY_CMDS:=\$PATHSUCK/put.news.body.conf}XX	export PUT_SED_HEAD_CMDS PUT_SED_BODY_CMDS RPOST_CONFXX	PATH=\${HOME}/suck:\${PATHBIN}:\${PATH}X	export PATHX_EOB}#################################################################################Main####SN=`basename $0`############################################### command line##########case $# in0 );;1 )X	case $1 inX	-h* )X		usage_fnX		exit 0X	;;X	-H*)X		usage_fnX		introduction_fnX		exit 0X	;;X	-u* )X		set_inn_conf_path_fnX		get_innconf_vars_fnXX	 	if [ -f $HOME/suck/$SuckEnvRc.$Org ]X		thenX			#X			## cp not mv as this file is linkedX			#X			cp -p $HOME/suck/$SuckEnvRc.$Org $HOME/suck/$SuckEnvRcX			rm -f $HOME/suck/$SuckEnvRc.$OrgX		fiXX		if [ -f $HOME/suck/active-ignore.$Org ]X		thenX			mv $HOME/suck/active-ignore.$Org $HOME/suck/active-ignoreX		fiXX		if [ -f $PATHETC/newsfeeds.$Org ]X		thenX			mv $PATHETC/newsfeeds.$Org $PATHETC/newsfeedsX		fiXX		if [ -f $PATHDB/active.$Org ]X		thenX			ctlinnd pause "reset active"X			mv $PATHDB/active.$Org $PATHDB/activeX			ctlinnd reload active "reset active"  X			ctlinnd go "reset active"  X		fiX		exit 0X	;;X	esac;;* )X	usage_fnX	exit 1;;esac###################################################################check that suck is presentif [ ! -x /usr/bin/testhost ]thenX	echo "ERROR:$SN:main:5:no /usr/bin/testhost is suck installed? --  bailing out" 1>&2 X	exit 1fi##################################################################XXif [ "$Verbose" == "-v" ] thenX	introduction_fnfiXprint_fn "lets see who i am:"WHOAMI=`who_am_i_fn`if [ $? -ne 0 ]thenX	echo "ERROR:$SN:main:10:who_am_i_fn failed --  bailing out" 1>&2 X	exit 1fiXif [ "$WHOAMI" != "$NewsUser" ]thenX	echo "ERROR:$SN:main:20:user $WHOAMI is NOT NewsUser $NewsUser --  bailing out" 1>&2 X	exit 1fiXprint_fn "I am $WHOAMI"Xprint_fn "check that $HOME/suck exists"if [ ! -d $HOME/suck ]thenX	echo "ERROR:$SN:main:30:no dir $HOME/suck  --  bailing out" 1>&2 X	exit 1fiXprint_fn "Yes $HOME/suck found"X################################################################### set up the paths used by get.news.inn script# by looking in the INN_CONF dir for the# true values#######################################set_inn_conf_path_fnprint_fn "Setting up variables based on $INN_CONF"get_innconf_vars_fnall_innconf_set_fnif [ $? -ne 0 ]thenX	display_innconf_fnfiX### Add bin dir for inn to the PATH variable so that## other commands can be called without the path variable ## needing to be prepended to each one#PATH=$PATHBIN:${PATH}X##################################################################print_fn "Checking on, and if needed setting up history"########INN_HIST=${INN_HIST:=$PATHDB/history}if [ -f $INN_HIST ]thenX	if [ "$Verbose" == "-v" ]X	thenX		ls -l $PATHDB/history*X	fielseX	print_fn "Attempting to create a history database"X	makehistoryX	if [ $? -ne 0 ]X	thenX		echo "ERROR:$SN:main:40:makehistory failed --  bailing out"  1>&2X		exit 1X	fiXXX	makedbz -iX	if [ $? -ne 0 ]X	thenX		echo "ERROR:$SN:main:50:makedbz -i failed --  bailing out"  1>&2X		exit 1X	fiXX	cp -p $PATHDB/history.n.dir $PATHDB/history.dirX	cp -p $PATHDB/history.n.hash $PATHDB/history.hashX	cp -p $PATHDB/history.n.index $PATHDB/history.indexX	makedbzX	if [ $? -ne 0 ]X	thenX		echo "ERROR:$SN:main:60:makedbz failed --  bailing out"  1>&2X		exit 1X	fiXX	rm -f $PATHDB/history.n.*fiXif [ ! -f $INN_HIST ]thenX	echo "ERROR:$SN:main:70:$INN_HIST does not exist" 1>&2X	exit 1fiX##################################################################print_fn check that innd is running########innd_pid=`pidofproc_fn innd`if [ "$innd_pid" == "" ]thenX	echo "ERROR:$SN:main:80:innd is not running ask root to start it  --  bailing out"  1>&2X	exit 1fiX##################################################################print_fn "Setting up addresses to local and remote NTTP servers "########XLOCALHOST=${LOCALHOST:=localhost}Xprint_fn "Checking if the environment variable NNTPSERVER is set: $NNTPSERVER"set_env_fn "$NNTPSERVER" "Please enter your ISP server name eg \"news.theperfectisp.com\": "NNTPSERVER=$EnvTmpXcreate_suckenvrc_fnrm -f $HOME/$SuckEnvRcln $HOME/suck/$SuckEnvRc $HOME/$SuckEnvRcX################################################################# print_fn "Setup active active-ignore and sucknewsrc files "########TEST_NEWS_GROUP=${TEST_NEWS_GROUP:=alt.test}#TEST_NEWS_GROUP=${TEST_NEWS_GROUP:=test.test.test}TEST_NG_PATH=`echo $TEST_NEWS_GROUP | sed "s:\.:/:g"`Xctlinnd pause "edit active"if [ $? -ne 0 ]thenX	print_fn "Trying to restart with ctlinnd go \"edit active\""X	ctlinnd go "edit active"X	ctlinnd mode	X	echo "ERROR:$SN:main:90:ctlinnd pause failed --  bailing out" 1>&2 X	exit 1fiXif [ ! -f $PATHDB/active ]thenX	cat >$PATHDB/active <<- _EOBX		control 0000000000 0000000001 nX		control.cancel 0000000000 0000000001 nX		control.checkgroups 0000000000 0000000001 nX		control.newgroup 0000000000 0000000001 nX		control.rmgroup 0000000000 0000000001 nX		junk 0000000000 0000000001 nX		$TEST_NEWS_GROUP 0000000000 0000000001 yX	_EOBelseX	grep -s "^$TEST_NEWS_GROUP" $PATHDB/active >/dev/nullX	case $? inX	1 )X		#X		## no match append it on the bottom of the fileX		#X		if [ ! -f $PATHDB/active.$Org ]X		thenX			cp -p $PATHDB/active $PATHDB/active.$OrgX		fiX		ctlinnd newgroup "$TEST_NEWS_GROUP" y news@$LOCALHOSTX		if [ $? -ne 0 ]X		thenX			echo "ERROR:$SN:main:100:ctlinnd newgroup failed --  bailing out" 1>&2 X			exit 1X		fiX	;;	X	2 )X		echo "ERROR:$SN:main:110:grep $PATHDB/active  failed -- bailing out" 1>&2X		exit 1X	;;X	esacfiXif [ ! -f $HOME/suck/active-ignore ]thenX	#X	## ignore all groups apart from $TEST_NEWS_GROUPX	#X	grep -v $TEST_NEWS_GROUP $PATHDB/active | sed "s/ .*//" >>$HOME/suck/active-ignoreelseX	#X	## strip out $TEST_NEWS_GROUP if it is there because we need it.X	#X	if [ ! -f $HOME/suck/active-ignore.$Org ]X	thenX		cp -p $HOME/suck/active-ignore $HOME/suck/active-ignore.$OrgX	fiX	grep -v $TEST_NEWS_GROUP $HOME/suck/active-ignore >/tmp/$SN.$$X	cp /tmp/$SN.$$ $HOME/suck/active-ignore X	rm /tmp/$SN.$$fiXif [ "$Verbose" == "-v" ]thenX	echo "Please fix by hand problems shown by $PATHBIN/inncheck" X	echo "inncheck start problem list ###############################"X	inncheckX	echo "inncheck end ##############################################"fiXctlinnd reload active "edit active"  if [ $? -ne 0 ]thenX	echo "ERROR:$SN:main:120:ctlinnd reload failed --  bailing out" 1>&2 X	exit 1fiXctlinnd go "edit active"  if [ $? -ne 0 ]thenX	echo "ERROR:$SN:main:130:ctlinnd go failed --  bailing out" 1>&2 X	exit 1fi##################################################################print_fn "setup sucknewsrc $TEST_NEWS_GROUP"### use host to bring up a connection if it is a dialup one## run get.news.inn to set up a sucknewsrc with $TEST_NEWS_GROUP## in it. It will not post messages yet because there is## no entry in /etc/news/feeds#Xprint_fn "get the records group $TEST_NEWS_GROUP"########SUCK_DEBUG="-D"$HOME/suck/get.news.inn Xif [ -d $PATHARTICLES/$TEST_NG_PATH ]thenX	PA=${PATHARTICLES}/$TEST_NG_PATHelseX	PA=${PATHARTICLES}fifind $PA -type f -exec grep "^Path:" {} \;| sed -e "s/.[^\!]*\!//" -e "s/\![^!].*/!/" | \sort -u | \grep "!$" |sed "s/!$//" >/tmp/$SN.1.$$XNUM_LINE=`wc -l /tmp/$SN.1.$$ | sed -e "s/ [^ ][^ ]*$//" -e "s/ //g"` Xcase $NUM_LINE in0 )X	cat <<- _EOBX	There is a problem this script has been unable to find a string toX	use as a the remote host identifier.X	X	Each message which appears on the local host is stored in X	subdirectories under $PATHARTICLES so an article the news groupX	comp.os.linux.answers will be inX	"$PATHARTICLES/comp/os/linux/answers". This script looks for articlesX	in $PATHARTICLES/$TEST_NG_PATH if that dir does not exist then itX	looks at all articles on the local host from ${PATHARTICLES}.XX	That this message has been displayed shows that there are no articlesX	with a line starting Path: on the local host. To fix this problemX	use your favourite news browser set to use news server of the ISP andX	and post a test article to $TEST_NEWS_GROUP, then re-run this script,X	if you come back to this page for a SECOND time, then there is aX	problem which is beyond the scope of this script to fix for you. ButX	some of the things you should check are:X	* Is the innd up and running?X	* Does the active file exist?X	* Is the line  "$TEST_NEWS_GROUP 0000000000 0000000001 y" exist inX	  the active file?X	* Check that in the suck dir that $TEST_NEWS_GROUP is NOT in the fileX	  active-ignore.X	* If both are true then there is a problem with the paths to the X	  files.X	* check that the history file exists. If not then there is a problemX	  with the path to history.X	* If there is a problem with paths use "innconfval -s" to check whatX	  the paths are. As this script uses "innconfval", if it can find it,X	  then the script MUST be confused. Use "find / -name innconfval" toX	  find all instances of "innconfval" on the local system and run eachX	  one in turn. Check for differences between them and when you

⌨️ 快捷键说明

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