The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Reg: Gzip sam99 Shell Programming and Scripting 5 01-30-2008 07:43 AM
difference between 'compress' and 'gzip' anandapani UNIX for Dummies Questions & Answers 3 12-15-2007 02:01 PM
gzip mfran2002 SCO 1 12-01-2003 10:23 AM
using gzip nattie_h UNIX for Advanced & Expert Users 2 11-15-2002 11:28 AM
compress --> gzip 98_1LE UNIX for Dummies Questions & Answers 2 03-12-2001 01:51 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-16-2009
narayanv narayanv is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 9
gzip instead of compress

Duplicate threads merged jmc

Hi,

I have a script wherein I want to use gzip instead of compress.
# cat dly_appsfiles_bkp.ksh
#
# dly_appsfiles_bkp.ksh
#
date_stamp=`date +%m%d%y`
base_dir=/u05/gld1
sub_dir=apps
bkp_dir=/u00/backup/GLD1/APPS
bkp_file_name=${sub_dir}_${date_stamp}.tar.Z
echo ""
echo "Starting Compressed Apps Files backup ..."
echo "Compressed backup file name: ${bkp_dir}/${bkp_file_name}"
echo ""
cd ${base_dir}
tar cvf - ${sub_dir} | compress > ${bkp_dir}/${bkp_file_name}
echo ""
cd $bkp_dir
ls -ltr *.Z
mailx -s "Done" abc@abc.com<<EOF
Backup done
EOF
echo ""
echo "Done."
echo ""

I'm new to shell scripting.Can someone please help me on how this can be modified?

Thanks,

Last edited by jim mcnamara; 06-16-2009 at 12:39 PM..
  #2 (permalink)  
Old 06-16-2009
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,913
Have not tested this but it should work. Change
Code:
bkp_file_name=${sub_dir}_${date_stamp}.tar.Z
to
Code:
bkp_file_name=${sub_dir}_${date_stamp}.tgz
and
Code:
tar cvf - ${sub_dir} | compress > ${bkp_dir}/${bkp_file_name}
to
Code:
tar cvzf - ${sub_dir} > ${bkp_dir}/${bkp_file_name}
and
Code:
ls -ltr *.Z
to
Code:
ls -ltr *.tgz

Last edited by fpmurphy; 06-16-2009 at 10:21 AM..
  #3 (permalink)  
Old 06-16-2009
narayanv narayanv is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 9
use gzip instead of compress

Hi,

I need to modify a script wherein need to use gzip instead of compress.
The script is
# cat dly_appsfiles_bkp.ksh
#
# dly_appsfiles_bkp.ksh
#
date_stamp=`date +%m%d%y`
base_dir=/u05/gld1
sub_dir=apps
bkp_dir=/u00/backup/GLD1/APPS
bkp_file_name=${sub_dir}_${date_stamp}.tar.Z
echo ""
echo "Starting Compressed Apps Files backup ..."
echo "Compressed backup file name: ${bkp_dir}/${bkp_file_name}"
echo ""
cd ${base_dir}
tar cvf - ${sub_dir} | compress > ${bkp_dir}/${bkp_file_name}
echo ""
cd $bkp_dir
ls -ltr *.Z
mailx -s "Done" abc@abc.com<<EOF
Backup done
EOF
echo ""
echo "Done."
echo ""

Please let me know how this can me modified?

Thanks
  #4 (permalink)  
Old 06-16-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
change to this
Code:
tar cvf - ${sub_dir} | gzip - > ${bkp_dir}/${bkp_file_name}.gz
Also some versions of tar support "tar zcvf" wghich also uses gzip compression to compress the file. Check your tar man page.
Code:
tar zcvf - ${sub_dir} > ${bkp_dir}/${bkp_file_name}.gz
  #5 (permalink)  
Old 06-29-2009
narayanv narayanv is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 9
Hi,

The size of the backup file is 0 bytes.
Its not copying any files for backup.

-rw-r--r-- 1 appldev1 dba 0 Jun 29 08:34 oraInventory_062909.tgz

This is on AIX.

Regards,
Narayan

---------- Post updated at 07:59 PM ---------- Previous update was at 06:18 PM ----------

tar zcvf - ${sub_dir} > ${bkp_dir}/${bkp_file_name}.gz does not seem to be working on AIX.
Please suggest.

Regards
  #6 (permalink)  
Old 06-30-2009
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,913
First check that your version of tar supports the -z option i.e. man tar.

If it does, try the following
Code:
tar zcvf ${bkp_dir}/${bkp_file_name}.gz ${sub_dir}
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0