1761348 Members
2796 Online
108901 Solutions
New Discussion юеВ

'gzip' a large file.

 
SOLVED
Go to solution
Jennifer Lam
Advisor

'gzip' a large file.

I have a script to backup many of masterfiles (total size about 4M)on a workstation. I am using crontab command to set up for a backup. In script, I created a gzip command to reduce the size:
gzip
After the crontab processed, I got the file named is instead of the . BUT when I executed the script by manually, it worked fine I got the 25K size & the file named is
I try a compress command (compress ); It is working fine by using the crontab process which reduce the file about 40K and give the file named is .
Would you please help me with the gzip problem. Thank you
Best regards,
Jennifer Lam
4 REPLIES 4
Vincent Fleming
Honored Contributor
Solution

Re: 'gzip' a large file.

It sounds like it can't find the gzip program...

When scripts run via cron, they may not have the same PATH as when you are logged in.

Always use absolute path names for commands in your scripts. For example:

/usr/local/bin/gzip

rather than

gzip

I hope this helps!

Good luck

No matter where you go, there you are.
S.K. Chan
Honored Contributor

Re: 'gzip' a large file.

My "gzip" is in ..

/usr/contrib/bin
H.Merijn Brand (procura
Honored Contributor

Re: 'gzip' a large file.

1. GNU tar has a builtin gzip with the -z option, which would save you a lot of time and disk space

tar -czvf archive.tgz .

2. You can tar/gzip on the fly using '-' as file

tar cvf - . | gzip -9 >archive.tar.gz

3. bzip compresses much more, so if disk or tape space is a problem you could consider the move to bzip2. Compressions is slower than gzip, but decompression is not

HTH
Enjoy, Have FUN! H.Merijn
Juan Manuel L├│pez
Valued Contributor

Re: 'gzip' a large file.

Hi,
Your problem is your script do not find the path where gzip is.
You have to put the path inside the script.
If you do not know where it is use this command from / :
find . -name gzip -print
Will show you the path.

I hope this help.

Juanma.
I would like to be lie on a beautiful beach spending my life doing nothing, so someboby has to make this job.