LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (http://www.linuxquestions.org/questions/general-10/)
-   -   Backup Script error "line 31: syntax error: unexpected end of file" (http://www.linuxquestions.org/questions/general-10/backup-script-error-line-31-syntax-error-unexpected-end-of-file-602971/)

eswanepoel 11-28-2007 07:00 AM

Backup Script error "line 31: syntax error: unexpected end of file"
 
This script us to work then one of the Admin guys did something to it. Now it gives the following error when running.

./backup2tape: line 26: unexpected EOF while looking for matching `"'
./backup2tape: line 31: syntax error: unexpected end of file
-----------------------------------------------------------
This is the Script

###########################################################
#
# BACKUP TO TAPE FOR APPX
#
# Backup from /BACKUPS/Bkp2Disk_D onto tape
# Backup files are all the tar files in /BACKUPS/Bkp2Disk_D
# should be DayXZ.tar files & WeekYZ.tar files where:
# X = 1-4 and
# Y = 1-4 and
# Z = A, L and S
#
# bkpdir = ??
#---- assignment of vars (file names & dir names)
eko="echo -e"
errfound="N"
bkpdir="/BACKUPS/Bkp2Disk_D
#
cd $bkpdir
tar cvf /dev/st0 *
if [ "$?" = "0" ]
then
errfound="N"
else
errfound="Y"
date=`date`
$eko "$date *** TAR DAILY/WEEKLY BACKUP TO TAPE FAILED !!!!! ******** " >> /BA
CKUPS/logs/tape-backup-err
fi
#
mt -f /dev/st0 rewoff

trickykid 11-28-2007 07:48 AM

Well, what did he change? Have you reverted back to the original? Try commenting out your little echo script on line 26 to see if that fixes the problem, seems that's what's causing the script to stop. And you should really paste your script inbetween the code tags, might be easier to read.

druuna 11-28-2007 08:16 AM

Hi,

First thing that I notice:

This: bkpdir="/BACKUPS/Bkp2Disk_D

should be: bkpdir="/BACKUPS/Bkp2Disk_D" (mind the closing double quote at the end).

Hope this helps.

jschiwal 11-28-2007 08:22 AM

You beat me to the punch. I spotted it as well, but maybe because that is an error I am too used to making myself.

trickykid 11-28-2007 08:33 AM

Quote:

Originally Posted by druuna (Post 2973318)
Hi,

First thing that I notice:

This: bkpdir="/BACKUPS/Bkp2Disk_D

should be: bkpdir="/BACKUPS/Bkp2Disk_D" (mind the closing double quote at the end).

Hope this helps.

Damnit, how did I miss that one as well.. oh well. I guess focusing on the line 26 error made me not notice as much. ;)

eswanepoel 11-30-2007 07:21 AM

Thanks for the " but now it complains
 
Now it complains about the "tar cvf /dev/st0 *"

druuna 11-30-2007 07:29 AM

Hi,

Tar's f option (as in tar cvf) expects a file, not a drive/device.

If you are actually backing up to a device (/dev/st0) remove the f. If you want to backup to file replace /dev/st0 by a filename.

tar --help to see all available options.

Hope this helps.

eswanepoel 12-07-2007 09:28 AM

Hi
Thanx for all the help. This is the last thing i had to change
"tar cvf /dev/st0 /*" it needed the /* and not *

Thanx again :)









Quote:

Originally Posted by druuna (Post 2975538)
Hi,

Tar's f option (as in tar cvf) expects a file, not a drive/device.

If you are actually backing up to a device (/dev/st0) remove the f. If you want to backup to file replace /dev/st0 by a filename.

tar --help to see all available options.

Hope this helps.



All times are GMT -5. The time now is 04:56 AM.