LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Very Simple Shell Script (https://www.linuxquestions.org/questions/linux-software-2/very-simple-shell-script-56564/)

cli_man 04-24-2003 08:49 AM

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?

jharris 04-24-2003 09:10 AM

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...

cli_man 04-24-2003 09:12 AM

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.

webtoe 04-24-2003 09:13 AM

{* 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

cli_man 04-24-2003 09:16 AM

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.

cli_man 04-24-2003 10:14 AM

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 11:16 PM.