Facing issues with tar and gzip !


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Facing issues with tar and gzip !
# 8  
Old 07-10-2012
The latest script posted is contains typing errors (not just the spelling of Archive). There is an extra space character in the destination of the mv command /app/local/XXX/XXX/XXX/logs /LogsBackup which could be a disaster.
There are two extra spaces in:
rm –f /app/local/XXX/XXX/XXX/logs / BLUESTAR_Archieve.log _$(date +%y_%m_%d_%H_%M)
which will give rm three separate arguments.


Anyway the process seems to contain the same design problem:
Code:
/app/local/XXX/XXX/XXX/logs/LogsBackup
is a subdirectory of:
/app/local/XXX/XXX/XXX/logs
so your tar will pick up the lot.

Now if your directory structure was like this, you would not have the problem:
Code:
/app/local/XXX/XXX/XXX/logs
/app/local/XXX/XXX/XXX/LogsBackup

# 9  
Old 07-10-2012
I wonder ...?
Quote:
tar –cvf BLUESTAR_Archieve.log _$(date +%y_%m_%d_%H_%M).tar /app/local/XXX/XXX/XXX/logs
Do understand this command? Ignoring the typing errors (extra space after .log) and the spelling of Archive.
It would take the entire contents of the directory tree /app/local/XXX/XXX/XXX/logs and archive it into an archive file called BLUESTAR_Archieve.log _$(date +%y_%m_%d_%H_%M).tar .
The command as stated does not create a tar archive of the single file called BLUESTAR_Archieve.log _$(date +%y_%m_%d_%H_%M) .


Also, evaluation the current time in every command is not a good idea. One day your script will overlap a change of minute.

I think that we need to know what the script is meant to do. If there is only one log, the tar is pointless.

Last edited by methyl; 07-10-2012 at 12:39 PM..
# 10  
Old 07-11-2012
Thanks Corona688 !!!

Even I also think so !

---------- Post updated at 12:39 PM ---------- Previous update was at 12:37 PM ----------

Hey Methyl thanks a lot !!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Facing issues with shell script changes

My current requirement is to replace xxyxx string with value of date date1 variable holds a date and the current script writes html tags to a file as follows echo date1 nawk 'BEGIN{ FS="," print "<HTML>""<HEAD>""<p>Hi All,<br><br>There are no cases closed on the xxyxx" print ... (2 Replies)
Discussion started by: Rajesh A S
2 Replies

2. Shell Programming and Scripting

Facing issues with rsync

Hello Gurus, I am running rsync command to copy certain Directories and files into that directories to remote server. While ruuning the command all teh files has been copied but I am facing error. The below command I am executing to copy Directories and files to remote server: rsync -avrz ssh... (3 Replies)
Discussion started by: pokhraj_d
3 Replies

3. Post Here to Contact Site Administrators and Moderators

Regarding facing issues while accessing UNIX.com site

Hello Moderators/Admins, This is regarding an issue which I am facing from last 7 to 8 days. Issue is while trying to access this forum(simple hitting http://unix.com) I am able to login but many times my request gets timed out or 404 error or if I am able to login it will be excessive slow even... (0 Replies)
Discussion started by: RavinderSingh13
0 Replies

4. Shell Programming and Scripting

Facing issues with cronjobs

Hello Everyone, We have a cronjob scheduled to pick up files from one system and transfer to another system. the underlying code is a shell script. These cronjobs were working correctly until sometime. 2 days back they did not pick up the scripts but created empty logs. However when we tried... (6 Replies)
Discussion started by: Rads
6 Replies

5. UNIX for Dummies Questions & Answers

Facing issues while running a cronjob !

Hi, I am trying to run a cronjob. But while doing so I am getting the following error message :- can't open yourfile in /var/spool/cron/crontabs directory. No such file or directory How can I resolve this issue ? Please help. Thanks Please view this code tag video for... (14 Replies)
Discussion started by: acidburn_007
14 Replies

6. UNIX for Advanced & Expert Users

tar and gzip extraction issues

Not sure if this is really in the right forum but here goes.... Looking for a way to extract individual compressed files from a compressed tarball WITHOUT tar -zxvf and then recompressing. Basically we need to be able to chunk out an individual compressed file while it still remains... (6 Replies)
Discussion started by: athos
6 Replies

7. UNIX for Dummies Questions & Answers

tar and gzip

Hi, I would like to have a combined gzip and tar that will compress and create multiple output tar.gz files. I want to have multiple files output because i cannot create an archive because there is no more space on my harddisk. I cannot transfer it locally because of slow connection. I want to... (3 Replies)
Discussion started by: tungaw2004
3 Replies

8. UNIX for Advanced & Expert Users

tar/gzip/gz...which one to use?

P0251WLADC.svm_wl1 > /svm_wl1/billing/data/server/archive/ALLEVT $ du -k FEB2006 22050224 FEB2006 As you can see,i have a folder called "FEB2006" which is around 22 GB. i guess zip or compress wont work...( i don know how do we compress a folder) i wished to use ""tar" ( i suppose... (5 Replies)
Discussion started by: abhijeetkul
5 Replies

9. UNIX for Dummies Questions & Answers

TAR and GZIP help

Hi, There are 700 .pdf files in a certain directory on the server and I need to TAR them first and then compress them using GZIP to free up the space. The combined size of the .pdf files is 3gb. However, there is only 1gb of free space on the server. So as you can see when I try to TAR these... (3 Replies)
Discussion started by: VandeMatram
3 Replies

10. UNIX for Dummies Questions & Answers

can i tar and gzip in one liner ?

hello can i combine this 2 commands in one liner command? (1 Reply)
Discussion started by: umen
1 Replies
Login or Register to Ask a Question