LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

Reply
 
Search this Thread
Old 11-28-2007, 07:00 AM   #1
eswanepoel
LQ Newbie
 
Registered: Aug 2004
Posts: 10

Rep: Reputation: 0
Angry 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
 
Old 11-28-2007, 07:48 AM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
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.
 
Old 11-28-2007, 08:16 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
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.
 
Old 11-28-2007, 08:22 AM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
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.
 
Old 11-28-2007, 08:33 AM   #5
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by druuna View Post
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.
 
Old 11-30-2007, 07:21 AM   #6
eswanepoel
LQ Newbie
 
Registered: Aug 2004
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks for the " but now it complains

Now it complains about the "tar cvf /dev/st0 *"
 
Old 11-30-2007, 07:29 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
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.
 
Old 12-07-2007, 09:28 AM   #8
eswanepoel
LQ Newbie
 
Registered: Aug 2004
Posts: 10

Original Poster
Rep: Reputation: 0
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 View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple bash script "unexpected end of line error" snowman81 Programming 11 11-11-2007 09:31 AM
bash "unexpected end of file" script error Runge_Kutta Linux - General 6 05-23-2007 03:36 PM
/usr/bin/lesspipe: line 223: syntax error: unexpected end of file fakie_flip Linux - Software 1 09-06-2006 02:22 AM
got a syntax error which shows unexpected end of line when tried to run a shell scrip racer_mec Linux - Newbie 1 01-10-2005 01:43 AM
Can I redirect script output to a file without ">> $LOGFILE" at the end of each line davee Linux - General 1 12-19-2003 05:01 AM


All times are GMT -5. The time now is 11:38 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration