Re: Amrecover hangs after restore

Gene Heskett <[email protected]>
Newsgroups gmane.comp.archivers.amanda.user
Organization none,nada,zip
Message-ID <[email protected]>
On Monday 14 December 2020 11:32:56 Nathan Stratton Treadway wrote:

> On Sun, Dec 13, 2020 at 03:05:16 -0500, Gene Heskett wrote:
> > ./bak-indices-configs: line 135: [: -gt: unary operator expected
>
> There does seem to be an error message coming from the amstatus
> program which we can investigate later, but as far as your own script
> not doing the coping I think that might be explained by the above
> error message.
>
> So, what's on line 135 of the bak-indices-configs script?
>
That is a very long if else fi thing, wordwrap off:
-------------------------------------------
if [ $PARTS_WRITTEN -gt 0 ]; then
	if [ $DUMMY -eq 1 ] ; then
		echo "DUMMY="$DUMMY" indices.tar."$TAPENAME" not written"
		echo "DUMMY="$DUMMY" configuration.tar."$TAPENAME" not written" 
		exit 7 # we ought to replace this with a defined error code just to be 
neat.
	else 
		if [ $VTAPES -eq 1 ] ; then
			echo "Using a vtape, so copying the indices & configuration to the 
vtape data dir."
# Amanda has stopped using the link 'data' to point to the correct tape, 
breaking this script
#			rm -f ${VTAPE_LOCATION}/data/indices.tar # replace outdated file
			rm -f ${VTAPE_LOCATION}/$DATALOC/indices.tar # replace outdated file

#			cp indices.tar.$TAPENAME ${VTAPE_LOCATION}/data/indices.tar
			cp indices.tar.$TAPENAME ${VTAPE_LOCATION}/$DATALOC/indices.tar

			echo "Here are the contents of indices.tar" >> dd.report.$TAPENAME
#			tar tf ${VTAPE_LOCATION}/data/indices.tar >> dd.report.$TAPENAME
			tar tf ${VTAPE_LOCATION}/$DATALOC/indices.tar >> dd.report.$TAPENAME

#			rm -f ${VTAPE_LOCATION}/data/configuration.tar # replace outdated 
file
			rm -f ${VTAPE_LOCATION}/$DATALOC/configuration.tar # replace outdated 
file

#			cp configuration.tar.$TAPENAME 
${VTAPE_LOCATION}/data/configuration.tar
			cp configuration.tar.$TAPENAME 
${VTAPE_LOCATION}/$DATALOC/configuration.tar

			echo "And here is the contents of configuration.tar" >> dd.report.
$TAPENAME
#			tar tf ${VTAPE_LOCATION}/data/configuration.tar >> dd.report.
$TAPENAME
			tar tf ${VTAPE_LOCATION}/$DATALOC/configuration.tar >> dd.report.
$TAPENAME
		else
			#Real tape
			echo "Using a real tape, so writing the indices & configuration using 
dd"

			# once for the file & once for value
			# due to the possibility of a double eof being written by amanda
			mt -f /dev/nst0 seod

			dd if=indices.tar.$TAPENAME of=/dev/nst0 bs=32768 conv=sync 2>&1 >> 
dd.report.$TAPENAME
			if [ $? -ne 0 ] ; then
				echo "dd command failed. Amanda configuration & indices not written 
to tape ! (tape 
full?)"
				exit 4
			fi
			echo "Here is the contents of indices.tar.$TAPENAME"
                        tar tf indices.tar.$TAPENAME >> dd.report.
$TAPENAME

			dd if=configuration.tar.$TAPENAME of=/dev/nst0 bs=32768 conv=sync 2>&1 
>> dd.report.$TAPENAME
			if [ $? -ne 0 ] ; then
				echo "dd command failed. Amanda configuration not written to tape ! 
(tape full?)"
				exit 5
			fi
			echo "And here is the contents of configuration.tar.$TAPENAME"
			tar tf configuration.tar.$TAPENAME >> dd.report.$TAPENAME
			mt -f /dev/nst0 weof 1
			echo "Rewinding tape"
			mt -f /dev/nst0 rewind
		fi
	fi

else
	echo $TAPENAME" was not written to as amstatus $CONFIGNAME reported it 
had not written any partitions to tape." | 
tee -a dd.report.$TAPENAME
	exit 6
fi
------------------------------

Good luck wading thru my keyboard mutterings from 16 years ago, Nathan.



Copyright 2019 by Maurice E. Heskett
Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.