Dear Monks - a little help here would be highly valued..
OS NAME: Red Hat Enterprise Linux 5 RHEL5
Perl version: v5.8.8 built for x86_64-linux-thread-multi
Module Version: Archive::Extract v?
Situation: A bash script 'my_bash.txt' invokes my_perl.pl - both scripts enclosed.
TWO Problems:
1. If I don't manually invoke 'my_bash.txt' from the same dir that it resides in - for example /usr/my_dir/my_bash.txt -
the Archive::Extract module in /usr/my_dir/my_perl.pl extracts the output to the root folder '/' and not the correct working directory /usr/my_dir/.
2. If I invoke /usr/my_dir/my_bash.txt via root crontab - the Archive::Extract module will not work.
Please could someone help as I have been at this maddening process for days..
BASH SCRIPT BELOW (this invokes my_perl.pl)
#!/bin/sh #call perl script to download MODIS greening each decad /usr/bin/perl /work/locust1/swarmsdata/RasterData/greening/modis_green +ing.pl
PERL SCRIPT BELOW (is called by bash script above)
#!/usr/bin/perl use Archive::Extract; $Archive::Extract::PREFER_BIN=1; #if $inputZip exists unzip, store file correctly and remove date from +dekadalGet.txt if (-e $inputZip) { #unzip file print $timeStamp.' -New zip file successfully downloaded, unzipping fi +le: '."\n"."\n"; # create an archive object my $archive = Archive::Extract->new(archive => $inputZip); #extract the contents to the current working directory $archive->extract() or die "Can't extract: " . $archive->error; print $timeStamp.' -New zip file = '.$inputZip.' for '.$j.' successful +ly unzipped -> deleting file.'."\n"."\n"; #delete the zip file unlink($inputZip) or die "Zip file cannot be deleted."; unless (-e $inputZip) { print $timeStamp.' -New zip file successfully deleted: '."\n"."\n"; }
In reply to Perl Module Not Working In Crontab by dailyoliver
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |