Computing.Net > Forums > Unix > Perl Backup script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Perl Backup script

Reply to Message Icon

Name: Jesse Morrison
Date: November 26, 2002 at 17:34:59 Pacific
OS: UNIX
CPU/Ram: (Not useful in this situa
Comment:

I'm trying to write a backup script to backup a couple directories. This is what I have so far, it's not fleshed out because I've been getting errors:

#!/usr/bin/perl
$DATA = "/root/. /usr/local/.";
$CONFIG="/etc/. /var/lib/.";

system `tar cvfz data_full.tgz $DATA`;
system `tar cvfz config_full.tgz" $CONFIG`;

These are the errors I recieve after I run the script:

tar: Removing leading `/' from member names
sh: -c: line 1: unexpected EOF while looking for matching `"'
sh: -c: line 2: syntax error: unexpected end of file

Even with these errors it does create the data_full.tgz file, but before it finishes it outputs the last two errors to the screen.

Can anyone tell me what I'm doing wrong here? Thanks




Sponsored Link
Ads by Google

Response Number 1
Name: mark
Date: November 27, 2002 at 07:56:45 Pacific
Reply:

Hi-

I think I see the two problems. Right before the $CONFIG there is a double quote, remove it. The other thing is when you define your variables, get rid of the trailing slash, ie.

$CONFIG="/etc /var/lib";

That should get rid of the errors.

-Mark



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Perl Backup script

how to write backup scripting www.computing.net/answers/unix/how-to-write-backup-scripting/3099.html

Equivalent perl script for sed www.computing.net/answers/unix/equivalent-perl-script-for-sed/5939.html

Creating Scripts www.computing.net/answers/unix/creating-scripts/5668.html