Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-24-2003, 09:49 AM
|
#1
|
Member
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428
Rep:
|
Very Simple Shell Script
First off I don't know anything about shell scripting, so with that here is what I have, I made a very simple script to do an automatic backup every night of one of my servers to another server through nfs, I Have 2 directories that I am backing up right now (I am going to be adding more) The problem I am having is the script runs compleatly through and does the backup and the last thing it says is "tar: Error exit delayed from previous errors"
This script is backing up some files that may be in use (its about 60 websites) I will put the script below and see what you think, I think it is working right but that error worries me a bit.
rm -f /backup/backup.old.tar.gz
mv /backup/backup.tar.gz /backup.old.tar.gz
tar czvf /backup/backup.tar.gz /porky/sites
tar rzvf /backup/backup.tar.gz /porky/conf
And then when I want to run it I just type /etc/porky.conf which is the file above. So is this script right? or did I miss something to get that tar error I put above?
|
|
|
04-24-2003, 10:10 AM
|
#2
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
Re: Very Simple Shell Script
Quote:
Originally posted by cli_man
rm -f /backup/backup.old.tar.gz
mv /backup/backup.tar.gz /backup.old.tar.gz
tar czvf /backup/backup.tar.gz /porky/sites
tar rzvf /backup/backup.tar.gz /porky/conf
|
Would be better as
Code:
rm -f /backup/backup.old.tar.gz
mv /backup/backup.tar.gz /backup.old.tar.gz
tar czvf /backup/backup.tar.gz /porky/sites /porky/conf
HTH
Jamie...
|
|
|
04-24-2003, 10:12 AM
|
#3
|
Member
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428
Original Poster
Rep:
|
I wondered if that would be the way to do it, so I could put as many directories after that as I want? Right now I am backing up the sites and the web config directory, but I want to start backing up the user's directory and a few other odds and ends.
|
|
|
04-24-2003, 10:13 AM
|
#4
|
Member
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617
Rep:
|
{* oh well, someone has already solved this one *}
Can you unpacl the archives once the sript has finished?
What is printed to the screen when you run the individual commands outside of the script?
Alex
|
|
|
04-24-2003, 10:16 AM
|
#5
|
Member
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428
Original Poster
Rep:
|
Yes I can unpack the archives from the script, and it looks like everything is there, I am going to try the script from above and see if that works, I will report back.
|
|
|
04-24-2003, 11:14 AM
|
#6
|
Member
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428
Original Poster
Rep:
|
Ok using the script from jharris I am backing up 5 different folders now and it is working great, thanks.
|
|
|
All times are GMT -5. The time now is 12:31 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|