1855713 Members
10701 Online
104103 Solutions
New Discussion

Re: zipping doesn't work

 
Dave Chamberlin
Trusted Contributor

zipping doesn't work

I created a 4 scripts to make zipped copies of my oracle datafiles when the database shuts down for its cold backup. The scripts look like:
gzip -c /u11/oradata/PROD/ar02.dbf > /u10/archive/ar02.dbf.gz
I put in 4 lines at the end of the omniback pre-exec script that does the database shutdown, like:
/usr/local/bin/cpdfiles1 &
/usr/local/bin/cpdfiles2 &
etc. The first time the scripts ran, they worked fine. Each time since then, the scripts run, zipped files are created, all with size 0. The log in omniback which is running the pre-exec script for the backup gives errors for each line like:
/usr/local/bin/cpdfiles1.sh[5]:gzip: not found
No file permissions have changed. The scripts append their own log file with time stamps and status and show no system errors. Can someone tell me what might be going on?
4 REPLIES 4
RikTytgat
Honored Contributor

Re: zipping doesn't work

Hi,

The gzip executable probably is not in your PATH. Add /usr/contrib/bin to your PATH environment variable and try again. (That's where gzip resides)

Hope this helps,
Rik.
Bruce Regittko_1
Esteemed Contributor

Re: zipping doesn't work

Hi,

I would recommend using the full path to gzip, i.e., /usr/contrib/bin/gzip, in your script or else setting PATH in the script. It is too easy for the script to break if it relies on PATH being set outside the script.

--Bruce
www.stratech.com/training
Dan Hetzel
Honored Contributor

Re: zipping doesn't work

Hi Dave,

Even if the executable isn't found, the shell redirection you are using (re)creates a 0 length file, that's why you have them.

The reason why it ran the first time is because you most probably started it from an interactive shell, to test it, and that /usr/contrib/bin was in your $PATH.

You may either use the full path to gzip (/usr/contrib/bin/gzip), or modify your PATH (export PATH="$PATH:/usr/contrib/bin") in your script to make sure it will be found.

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Dave Chamberlin
Trusted Contributor

Re: zipping doesn't work

Thanks for the suggestions. I won't know if it works for a few days but seems reasonable - but it doesn't explain why it ran correctly the first time, since it has been run under identical (theoretically) conditions each time by omniback.