use strict;
use warnings;
################## Checking if regressions are running
my $jobs;
my $output=`bjobs -w | tr -s " " | cut -d " " -f7 | tail -n +2 | sort -u | grep -i "_pv_"`; ## Find out all the jobs running on cmd
print "$output is output\n";
When running the above code manually on a shell, it is running properly with no error. But when running it via crontab (12 23 * * * perl testScript.pl)
, it is throwing error. (Error: "bjobs command not found"
).
Why is it so? How can it be resolved?
Note: crontab has many scripts, so setting PATH variable at the top of crontab is challenging.