Syntax error with backup script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Syntax error with backup script
# 1  
Old 05-13-2011
Syntax error with backup script

Hi guys,

I'm new to Linux and dont know much about scripts..there's an backup script that will backup the database from a location to another location between servers..it will run automatically by adding it to crontab...it was created by another person and I tried to understand it somewhat..

I hope the script first checks if mount point is mounted and then starts backing up the database using From and To arguments..

I tried to run this script but it gives me syntax error...could someone please help me out with this..thanks in advance...Smilie

Quote:
#!/bin/bash
#
# creates backups of updated files for given day
#
# usage: backup_script.sh <from location> <to location>
# eg: backup_script.sh /home/oracle /backup/server/database/
# function DailyBackup()
#Variable declaration
FromLoc=$1
TOLoc=$2
FileName=D`date +%d`
mnt_point=/backup/
command=$(mount | grep $mnt_point | cut -d\ -f3)
{
{
if [ "$command" != "$mnt_point" ]
then
mount 172.19.0.26:/2TB/backup $mnt_point
else
echo "$mnt_point already mounted"
fi
}
{
find $FromLoc -mtime -2 -type f -print | tar zcvf $TOLoc/"$FileName".tgz -T -
}
}


Quote:
[root@server dbascript]# sh backup_script.sh
: command not foundine 14: {
: command not foundine 15: {
backup_script.sh: line 27: syntax error: unexpected end of file
# 2  
Old 05-13-2011
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

First Script Syntax Error

So, I'm writing my first shell script to try to speed up the process of creating lyric files for mocp and I don't know what the error is, but considering how short the code is, I'm betting it's something super-obvious. line 7: syntax error near unexpected token `echo' line 7: ` echo... (4 Replies)
Discussion started by: D351
4 Replies

2. Shell Programming and Scripting

Syntax error with automated backup script

Hi guys, I'm new to Linux and dont know much of scripting..there's an automated backup script that will backup the database from a location to another location between servers..it was created by another person and I tried to understand it somewhat.. I hope the script first checks if mount... (4 Replies)
Discussion started by: koolhart
4 Replies

3. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

4. UNIX for Dummies Questions & Answers

to take backup what is the command tell syntax

to take backup what is the command tell syntax (1 Reply)
Discussion started by: sunilamarnadh
1 Replies

5. Shell Programming and Scripting

Syntax error in script

Hey guys keep having problems with the below script syntax error near unpexpected token '0' exit 0 I have two directorys backups and Usr in the usr i have sub dir's wp,ss,pic which i would like to back up (copy those directorys to the backups directory) with user acknowledgement from command line.... (2 Replies)
Discussion started by: Spartukus
2 Replies

6. Shell Programming and Scripting

Syntax error with a script

Hi I not sure what is wrong with my script... when I try to run it I get the follow error: "remove: syntax error at line 77: `end of file' unexpected" Thanks in advance for any help. ans=y while do while : do echo "Please enter a name that you... (3 Replies)
Discussion started by: simpsonjr
3 Replies

7. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

8. Shell Programming and Scripting

Syntax error in script

I get this error when I try to run my script (BTW, this is a simple script I am supposed to write for my class) $ menuscript menuscript: syntax error at line 89 : `"' unmatched $ Here is the code (Any help is greatly appreciated) (Line numbers included) 1 #!/bin/ksh 2 ... (2 Replies)
Discussion started by: KindHead
2 Replies

9. Shell Programming and Scripting

syntax error in script !!

./disk_space_util.sh ./disk_space_util.sh: Syntax error at line 24 : `then' is not expected. ================================= cat disk_space_util.sh #!/bin/sh # # Parameter Settings ORA_LOG, ORA_SCRIPT, DBA_EMAIL_LIST -- (Set in .profile) bdf | sed "s/%/ /g" | sed "/Filesystem/d" |... (13 Replies)
Discussion started by: uuser
13 Replies

10. Shell Programming and Scripting

Syntax error in a script...

Hi All, I have been fighting with a syntax error for the last 2 days, still haven't got the solution. Could you please help me, your help will be greatly appreciated. In my script I am getting a error in a for loop, its similar to the one as is below. for v_id in v1 v2 v3 v4 do... (8 Replies)
Discussion started by: rajus19
8 Replies
Login or Register to Ask a Question