I would like to pass variables to a perl script by using "qsub -v" command. This is the perl script I would run (it's just a test but if it doesn't work I cannot do anything more difficult)
#!/usr/bin/perl
use Getopt::Long;
$result = GetOptions ("i=s" => \$config_file);
open(FILE,">/data/home/FILEout.txt");
open(FILE_CONFIG,"<$config_file");
while(<FILE_CONFIG>){
print FILE "$config_file\n";
}
close(FILE_CONFIG);
close(FILE);
So, if I would run this script (not through qsub) I would type:
perl Test.pl -i FILE_CONFIG.txt
However I would run this script on a node of a cluster that works with pbs. I have done several attemp like the following one:
qsub -l nodes=node06 -v i=/data/home/FILE_CONFIG.txt Test.pl
but it doesn't work. Anyone as an idea how I should pass the parameter to my perl script using qsub? Any help would be really appreciated
Doesn't work means that using qsub doesn't print nothing on the output file while using just perl it print the content of the input file in the output file. It looks like it doesn't take nothing in input
Would it be easier for you to submit the job this way:
echo "perl /absolute/path/to/Test.pl -i FILE_CONFIG.txt" | qsub -l nodes=node06
Then, as long as you know that Test.pl is in the path you specify on node06, it should work correctly.