djynen has asked for the wisdom of the Perl Monks concerning the following question:

I've written a Perl program that gzips files for archiving. The code is -
$status = system sprintf("/usr/local/bin/gzip %s/%s", $backupDir, $tar_filename);
When the Perl program is run in CRON it won't execute gzip. Is there a reason why gzip will not execute when the Perl program is run in CRON?

Replies are listed 'Best First'.
Re: Can I run gzip in a Perl program running from CRON?
by Anonymous Monk on Dec 11, 2001 at 10:14 UTC
    You're using a relative path, $backupDir does not exist in your home directory.
Re: Can I run gzip in a Perl program running from CRON?
by hakkr (Chaplain) on Dec 11, 2001 at 17:31 UTC
    Your much better off using the Archive::Zip module from CPAN. It means your script will be portable to other platforms.
Re: Can I run gzip in a Perl program running from CRON?
by Fastolfe (Vicar) on Dec 12, 2001 at 01:46 UTC
    First, make sure $backupDir is an absolute path to your backup directory. If that doesn't clear up the problem, we need more information. The text "will not execute" doesn't really help. Do you have an error message?