dailyoliver has asked for the wisdom of the Perl Monks concerning the following question:
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"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl Module Not Working In Crontab
by graff (Chancellor) on Jan 06, 2012 at 07:46 UTC | |
Re: Perl Module Not Working In Crontab
by ww (Archbishop) on Jan 05, 2012 at 23:24 UTC | |
Re: Perl Module Not Working In Crontab
by Anonymous Monk on Jan 05, 2012 at 22:23 UTC | |
Re: Perl Module Not Working In Crontab
by i5513 (Pilgrim) on Jan 06, 2012 at 00:49 UTC | |
Re: Perl Module Not Working In Crontab
by dailyoliver (Initiate) on Jan 09, 2012 at 18:34 UTC | |
by Anonymous Monk on Jan 10, 2012 at 09:06 UTC | |
Re: Perl Module Not Working In Crontab
by dailyoliver (Initiate) on Jan 11, 2012 at 22:26 UTC | |
by Anonymous Monk on Jan 12, 2012 at 08:12 UTC | |
by dailyoliver (Initiate) on Feb 07, 2012 at 11:53 UTC |