Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Short unix scripts -- AIX 5.3

Status
Not open for further replies.

mohmin

Technical User
Jun 13, 2005
38
0
0
US
Guys, I need help writing short scripts.
I manually backup important filesystems to tape by using following steps. lets say i need to backup /bkup filesystem to tape:

1. cd /tapebackup (/tapebackup is large file sized enabled JFS to hold the .tar and .tar.Z files)

tar cvf filename.date.tar /bkup

2. cd /tapebackup

compress -c filename.date.tar > filename.date.tar.Z

3. cd /tapebackup

tar cvf /dev/rmt0 filename.date.tar.Z


plz. help me with generating separate scripts for all these tasks, "date" should be the system date and in script3 a step should be included that wil be Email the admin at abc@yahoo.com when the tape backup is done.

Also, can we combine the scripts into one main script such that 2 is executed after 1 is finished and 3 is executed afer 2 is finished.

Thanks,
Moh.
 
cd /tapebackup
tar cvf filename.`date +%d%m%Y`.tar /bkup #Note backticks, #not apostrophes. Change +%d%m%Y to suit your locale.
compress filename.date.tar #Note no -c or >
tar cvf /dev/rmt0 filename.date.tar.Z
mail - your choice

Basically, just as you had above, but placed sequentially into a script so that you can run it (don't forget to chmod 755 (or whatever) to make it executable).
 
Ken,
if i am just using compress (no -c), its not working.

can we rather assign "compress -c" to something like X and use it.

I tried compressing a tar file by just saying "compress filename.tar", it ends saying compress does not save space.


plz help.

 
Why insist on compressing a file and then copying to tape if the compressed file is bigger than the original file?

That's just wasting CPU cycles and tape space...


If you really want to, use compress -f

from the man page:

-f Force compression of file, even if it is not actually reduced in
size. Additionally, files are overwritten without prompting for
confirmation.




HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top