Operating System - HP-UX
1753846 Members
7773 Online
108807 Solutions
New Discussion юеВ

Re: script to restore all the files and selected files in tar format

 
mohammed abdul jaleel
Occasional Contributor

script to restore all the files and selected files in tar format

i took the backup of all filesystem in hp-unix with backup script user tar command i need to restore all files and selexted files by script can any help me to restore the backup by script thanks
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: script to restore all the files and selected files in tar format

Hi:

To restore from your tar archive, do something like:

# tar -xvf myarchive

...or for individual file(s):

# tar -xvf myarchive file1 file2 file3

Regards!

...JRF...
mohammed abdul jaleel
Occasional Contributor

Re: script to restore all the files and selected files in tar format

but i need a script to do that i am attaching my backup script please provide me the script to restore please help me thanks
abir chowdhury
Advisor

Re: script to restore all the files and selected files in tar format

#tar -xvf /*
Steven Schweda
Honored Contributor

Re: script to restore all the files and selected files in tar format

> but i need a script to do that [...]

School assignment? Perhaps you should post
the actual requirements.

> i am attaching my backup script [...]

Interesting. I like the way it creates a
".tgz" file, but where does it do any gzip
compression? Doing an "rm", even if the
previous "tar" command failed, may be unwise.

> tar cf "/export/data/data_diff_$6-$2-$3.tgz" "$LIST"

What, exactly, do you think that this does?
Have you tried any of this stuff? (By the
way, should we non-psychics know what "$2",
"$3", and "$6" are in this case?)

> #creates backups of essential files

Probably not entirely true.

> i took the backup of all filesystem in
> hp-unix with backup script user tar command
> [...]

If you were depending on _this_ script for
your back-up operations, then you would seem
to be kidding yourself.
Dennis Handly
Acclaimed Contributor

Re: script to restore all the files and selected files in tar format

>I need a script to do that

You just do the reverse of your backup script:
# restore from weekly a full backup of all data and config. settings:
tar xf /export/data/data_full_$6-$2-$3.tgz

Note: you haven't gzipped that tar file.

tar xf /export/config/config_full_$6-$2-$3.tgz

# restore from incremental backup:
tar xf /export/data/data_diff_$6-$2-$3.tgz
tar xf /export/config/config_diff_$6-$2-$3.tgz

>abir: #tar -xvf /*

This "/*" isn't going to work unless the system has the exact files on the tape. AND you forgot the tarfile:
tar -xf foo.tar