LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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



Reply
 
Search this Thread
Old 04-24-2003, 09:49 AM   #1
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
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?
 
Old 04-24-2003, 10:10 AM   #2
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
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...
 
Old 04-24-2003, 10:12 AM   #3
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Original Poster
Rep: Reputation: 30
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.
 
Old 04-24-2003, 10:13 AM   #4
webtoe
Member
 
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
{* 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
 
Old 04-24-2003, 10:16 AM   #5
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Original Poster
Rep: Reputation: 30
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.
 
Old 04-24-2003, 11:14 AM   #6
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Original Poster
Rep: Reputation: 30
Ok using the script from jharris I am backing up 5 different folders now and it is working great, thanks.
 
  


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 Shell Script Help Kristijan Programming 3 06-13-2005 10:13 PM
Simple shell script mikz Linux - General 1 02-24-2005 08:18 AM
simple shell script sharpie Programming 9 06-03-2004 12:47 AM
a simple shell script Warchief Programming 1 07-31-2003 06:01 AM
Simple C Shell script is not so simple elconde Programming 2 09-17-2001 12:53 AM


All times are GMT -5. The time now is 04:07 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