tbm@anuck.UUCP (t.b.merrick) (12/21/87)
In article <782@grc.UUCP>, don@grc.UUCP (Donald D. Woelz) writes: > I am still having problems with my expire command and have not received > any response or help from my previous posting. > ... ... ... I have seen posted many of the problems which we overcame in an unpatched version of 2.11. My co-administrator mostly wrote the following shell script and we no longer have all those problems. Our directory placement will not match anyone elses, but you may find the techniques useful. This of course does not solve the loss of inodes problem. We overcome that by running fsck on Fridays. Sometimes we still get caught. We run on a 3B2/400 and a very recent ksh. The following script is run via cron at 14:30 hrs when our feed is NEVER incoming. As follows- # At least try the standard way. 30 2 * * * /usr2/news/news2.11/lib/expire -r -I -e14 -n all # Now go for it with our own flavor of forcing things. 30 14 * * * /usr2/news/adm/masterexpire Cron mails the results to news. We typically recover ~2 K inodes. Hope this helps someone. Credits to my co-administrator, complaints to me please. #+++++++++++++++masterexpire script begins here++++++++++++++++++++++ cd /usr/spool/news echo "master expire starts" date set `df /usr` # see how much space is in /usr so we can show changes BaseB=$3 BaseI=$5 InitB=$3 InitI=$5 # Now expire all the att newsgroup in 4 days except those following "!" /usr2/news/news2.11/lib/expire -e 4 -n att,\ !att.general,\ !att.lib.newbooks,\ !att.micro.pc,\ !att.misc,\ !att.news,\ !att.sources,\ !att.sys.3b,\ !att.sys.pc6300,\ !att.sys.unixpc,\ !att.unix,\ !att.workplace set `df /usr` # See how much we have gained. b=`expr $3 - $BaseB` i=`expr $5 - $BaseI` echo "recovered $b blocks and $i inodes from att" BaseB=${3} BaseI=${5} # Now go after all those in comp except those following "!" /usr2/news/news2.11/lib/expire -e 3 -n comp,\ !comp.bugs.sys5,\ !comp.dcom.modems,\ !comp.dcom.telecom,\ !comp.emacs,\ !comp.lang.c,\ !comp.lang.c++,\ !comp.mail.misc,\ !comp.mail.uucp,\ !comp.os.minix,\ !comp.risks,\ !comp.sources.bugs,\ !comp.sources.d,\ !comp.sources.games,\ !comp.sources.misc,\ !comp.sources.unix,\ !comp.sources.wanted,\ !comp.sys.att,\ !comp.sys.ibm.pc,\ !comp.sys.ibm.pc.digest,\ !comp.unix,\ !comp.unix.questions,\ !comp.unix.wizards,\ !comp.unix.xenix,\ !comp.windows.news,\ !comp.windows.x set `df /usr` b=`expr $3 - $BaseB` i=`expr $5 - $BaseI` echo "recovered $b blocks and $i inodes from comp" BaseB=${3} BaseI=${5} /usr2/news/news2.11/lib/expire -e 3 -n general set `df /usr` b=`expr $3 - $BaseB` i=`expr $5 - $BaseI` echo "recovered $b blocks and $i inodes from general" BaseB=${3} BaseI=${5} /usr2/news/news2.11/lib/expire -e 1 -n misc, \ !misc.consumers,\ !misc.consumers.house,\ !misc.forsale,\ !misc.headlines,\ !misc.invest,\ !misc.kids,\ !misc.legal,\ !misc.misc,\ !misc.security,\ !misc.taxes,\ !misc.test date set `df /usr` b=`expr $3 - $BaseB` i=`expr $5 - $BaseI` echo "recovered $b blocks and $i inodes from misc" BaseB=${3} BaseI=${5} /usr2/news/news2.11/lib/expire -e 3 -n news, \ !news.admin,\ !news.announce.conferences,\ !news.config,\ !news.groups,\ !news.lists,\ !news.misc,\ !news.newsites,\ !news.software.b,\ !news.sysadmin set `df /usr` b=`expr $3 - $BaseB` i=`expr $5 - $BaseI` echo "recovered $b blocks and $i inodes from news" BaseB=${3} BaseI=${5} /usr2/news/news2.11/lib/expire -e 1 -n rec, \ !rec.autos,\ !rec.aviation,\ !rec.ham-radio,\ !rec.ham-radio.packet,\ !rec.motorcycles,\ !rec.pets set `df /usr` b=`expr $3 - $BaseB` i=`expr $5 - $BaseI` echo "recovered $b blocks and $i inodes from rec" BaseB=${3} BaseI=${5} /usr2/news/news2.11/lib/expire -e 3 -n sci, \ !sci.crypt,\ !sci.electronics,\ !sci.math,\ !sci.math.stat,\ !sci.math.symbolic,\ !sci.space,\ !sci.space.shuttle set `df /usr` b=`expr $3 - $BaseB` i=`expr $5 - $BaseI` echo "recovered $b blocks and $i inodes from sci" BaseB=${3} BaseI=${5} /usr2/news/news2.11/lib/expire -e 1 -n soc talk set `df /usr` b=`expr $3 - $BaseB` i=`expr $5 - $BaseI` echo "recovered $b blocks and $i inodes from soc and talk" BaseB=${3} BaseI=${5} # exprire anything else that is left. /usr2/news/news2.11/lib/expire -e 14 set `df /usr` b=`expr $3 - $BaseB` i=`expr $5 - $BaseI` echo "recovered $b blocks and $i inodes from 14 day expire" BaseB=${3} BaseI=${5} # Now get anything expire did not. find /usr/spool/news -type f -mtime +15 -print | xargs rm # Probaly ought to rebuild the history file here if anything deleted. set `df /usr` b=`expr $3 - $BaseB` i=`expr $5 - $BaseI` echo "recovered $b blocks and $i inodes from find +15" BaseB=${3} BaseI=${5} b=`expr $BaseB - $InitB` i=`expr $BaseI - $InitI` echo "recovered $b blocks and $i inodes during master expire" date # The following are not included, but were locally written to # keep track of how many articles there are and to sumarize the # previous days feed results. #/usr2/news/adm/artcount > /usr2/news/adm/ARTcount #/usr2/news/adm/newslog | tee /usr2/news/adm/DailySummary # The following is from trimlib, which seems to be part of the news distribution # if this is run once per day, it will save the last # weeks worth of news log files. You can, of course, comment # out some of the lines to save less cd /usr2/news/news2.11/lib mv errlog.5 errlog.6 mv errlog.4 errlog.5 mv errlog.3 errlog.4 mv errlog.2 errlog.3 mv errlog.1 errlog.2 mv errlog.0 errlog.1 mv errlog errlog.0 cp /dev/null errlog mv log.5 log.6 mv log.4 log.5 mv log.3 log.4 mv log.2 log.3 mv log.1 log.2 mv log.0 log.1 mv log log.0 cp /dev/null log /bin/chown news errlog* log* history* +++++++++++++++++++++++++++script ends++++++++++++++++++++++++++++++ Tom Merrick ATT BTL Andover, MA