🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: de.admin.mail
Article #245

Script: Backup von bsmtp-batches

#245
From: Thomas Huppertz
Date: Fri, 22 Jan 1993 04:36
99 lines
3090 bytes
Hallo,

        an alle, die batch_smtp Mailverbindungen nutzen ...

Kuerzlich sind hier mehrere bsmtp-batches mit diversen Mails zu einem
Nachbarsystem geplatzt (Plattenplatzprobleme beim Nachbarsystem).
Aufgrund des smail-log habe ich die betreffenden Mail-Absender
alle informieren koennen, so dass wieder alles im Lot war.

Um solche Probleme in Zukunft zu vermeiden, sichere ich jetzt alle
batches als *.Z, so dass man den batch ggf. nach Problemen wieder ein
zweites Mal ausfuehren koennte. Da es ja auch fuer andere Systeme (die
batch_smtp nutzen) von Interesse sein koennte ...

... hier das modifizierte Script 'batchsmtp' dazu:
    (Aenderungen mit #*** gekennzeichnet)
======================================================================
#!/bin/sh
# @(#)samples/bsmtp/batchsmtp.sh	1.5 7/30/92 06:03:45

# deliver messages accumlated into subdirectories of the
# outq spool directory.  Subdirectory names are based on
# the actual hostnames involved:

LOCALHOST=rechner.domain.sub.org
MAXSIZE=100000

#*** Expire zum loeschen der Batch-Sicherungen

EXPIRE_DAYS=14


OUTQ=/usr/spool/smail/outq
UUX=/usr/bin/uux

cd $OUTQ || exit 1

# loop through all of the subdirectories
for i in *
do
    (
	# change to directory or exit subshell
	test -d $i || exit
	cd $i || exit 1

	# send multiple batches
	while :
	do
		# get the list of message files; quit if none
		msgs="`ls q* 2>/dev/null`"
		test -n "$msgs" || break

		# accumulate until total size exceeds maximum
		send=
		sz=0
		for f in $msgs
		do
			send="$send $f"
			n=`wc -c <$f 2>/dev/null`
			test -n "$n" || continue
			sz=`expr $sz + $n`
			test $sz -lt $MAXSIZE || break
		done

		# send messages, adding HELO and QUIT commands
		( echo "HELO $LOCALHOST"
		  cat $send
		  echo QUIT ) | $UUX - $i!rsmtp

#*** Sonderbehandlung zum Sichern
		# remove messages that were sent
		# rm $send
		# Oh, No - please do _not_ !
		# Save them if something goes wrong with the mails 
		Save=`date +%y%m%d%H%M%S`
		( echo "HELO $LOCALHOST"
		  cat $send
		  echo QUIT ) > $Save
		compress $Save

		# ... and now delete them
		rm $send
	done
    
#*** Expire der Sicherungsfiles
	# Alte Files Loeschen
	find . -mtime +$EXPIRE_DAYS -exec rm {} \;
    )

done

exit 0

-- 
==================== Gruss: === Thomas === Huppertz  ========================
       HUPPERTZ EDV-Beratung, Thererstr. 10, 8083 Mammendorf, Germany 
               Tel. ++49-8145-1569, Fax. ++49-8145-8286 
==================== EMail:== thu@huedv.hu.sub.org ==========================
Technical Details
Message-ID: <3513@huedv.hu.sub.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!howland.reston.ans.net!sol.ctr.columbia.edu!ira.uka.de!smurf.sub.org!mamunx!imutm1.de.intel.com!gold.sub.org!susan!stasys!huedv!thu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!howland.reston.ans.net!sol.ctr.columbia.edu!ira.uka.de!smurf.sub.org!mamunx!imutm1.de.intel.com!gold.sub.org!susan!stasys!huedv!thu
From: thu@huedv.hu.sub.org (Thomas Huppertz)
Newsgroups: de.admin.mail
Subject: Script: Backup von bsmtp-batches
Message-ID: <3513@huedv.hu.sub.org>
Date: 22 Jan 93 04:36:48 GMT
Reply-To: thu@huedv.hu.sub.org
Organization: HUPPERTZ EDV-Beratung, Thererstr. 10, 8083 Mammendorf, Germany
Lines: 99