in reply to Problems using gzip in a Perl program
First of all it is a good practice to use the list form of system or the qx// operator which does the same thing. Like this:
$status = qx(/usr/bin/tar cf $backupDir/$tar_filename tempDir); $status = system qx(/usr/local/bin/gzip $backupDir/$tar_filename);
My guess is the script is probably failing via cron because /usr/local/bin isn't on crons' default path. You should put a line like:
at the top of your crontab and also for safetys' sakePATH=/usr/local/bin:/usr/bin:/bin
This works on LinuxSHELL=/bin/sh
Update: Hrmph, dws already answered this one. That'll teach me to write a post, go make a sandwich, and then click on submit. :-) But I should also mention there are Archive::Tar and Compress::Zlib(for gzip) modules on CPAN whereby you can avoid all this messy shelling to external programs.
|
|---|