So, OK, the job runs in cron: it fetches compressed files and processes them. If the files are corrupted, it deletes them. Sometimes they are bad on the remote server, in which case they will be downloaded and deleted each time.
My cron logs extensively to STDOUT (directed to logfile in .crontab), using STDERR only for things that cause the script to stop: I like getting emails from cron when bad stuff happens; it's just that corrupted files should not be on this list.
I need the output from 'gunzip' to tell me if the file is corrupted. However, I am tired of getting emails from cron every time it encounters a bad file. How do I call 'gunzip' so that errors will not trigger emails from cron, while still letting the script that calls 'gunzip' know that it failed?
This is probably a pretty easy one, but I'm pretty new to this cron stuff.
Important PS: 'gunzip' is called from a Perl script, using
$gunzip_result=system("gunzip $gzfile");
if($gunzip_result){
print,"$gzfile is bad: deleting...\n";
unlink $gzfile;
};