I have a test unix server in which currently some unix cronjob are running.
I have written two script one is a shell script in which env variable are there (in that i am exporting those variables).
I have also written a perl script .
when i am running at the shell manually like below it is working fine.
. /dir1/dir2/script.env; /dir1/dir2/script.pl
but when i am running for every minute by the help of cron job.
I mean when i am adding this above job in "crontab -e" like below.
actually in the second file which is perl file the initial lines looked like
#!/opt/perl/bin/perl -I/opt/perl/lib/site_perl -I/opt/perl/lib
use strict;
use Net::SFTP;
use Net::SFTP::Util qw (fx2txt);
use Net::FTP;
use Data::Dumper;
use DBD::Oracle qw(:ora_types);
use MIME::Lite;
But now though we are using the scp to include in the perl file
we are include one module in the perl file (in sence ,we have added a line" use Net::SCP::Expect;"like below) and the current initial lines looks like
#!/opt/perl/bin/perl -I/opt/perl/lib/site_perl -I/opt/perl/lib
use strict;
use Net::SFTP;
use Net::SFTP::Util qw (fx2txt);
use Net::FTP;
use Net::SCP::Expect;
use Data::Dumper;
use DBD::Oracle qw(:ora_types);
use MIME::Lite;
and inside the pl we are using scp for secure copy.
now I think i got the problem due to this additional module which we added in the perl script that is making the cron job not running (but first .env script is working in both of cases"as it before and now").
I think some where cron is mainting these modules for "scp"(which should be added in cron list).
I have tried a lot it is not working(as a developer i am not accesed to open cron log) after implemented the "use Net::SCP::Expect; " (think should be added somewhere in cron list which should be done by unix admin).
First, #! can only have one argument, like "#!/usr/bin/sed -f", see man execvp. Maybe make a shell script wrapper for your perl call, so you can have any command line you want. I get very little use out of anything but #!/usr/bin/ksh or the bash equivalent. I find I can test/enhance better with a wrapper.
Make your cron command log somewhere permanent, so you can see if it has anything to tell you: