file_put_contents("{$TEMPNAM}.sh", myPilotJob($poolURL));
        $njobs = floor($ntokens / 5.9) + 1;
        # This number is to be tweaked.
        $shellscript = basename("{$TEMPNAM}.sh");
        file_put_contents("{$TEMPNAM}.jdl", <<<EOS
JobType = "Parametric";
Executable = "/bin/sh";
Arguments = "{$shellscript}";
InputSandbox = {"{$TEMPNAM}.sh", "/home/portal/opt/curl/bin/curl"};
Parameters = {$njobs};
ParameterStep = 1;
ParameterStart = 0;
StdOutput = "std.out";
StdError = "std.err";
OutputSandbox  = {"std.out", "std.err"};
ShallowRetryCount = 0;
MyProxyServer = "{$proxyserver}";
EOS
);
        putenv("X509_USER_PROXY={$vomsproxy}");
        $idfile = Portal::PROXY_DIR . $userdnmd5 . '.' . $vo . '.ids';
        $output = '';
        exec("glite-wms-job-submit -a -o '{$idfile}' {$TEMPNAM}.jdl 2>&1", $output, $returnval);
        if ($returnval) {
            $output = implode("\n", $output);
            Portal::debug("{$userdn}\n\n{$output}");
            continue;
        }
        echo "Job submission succesful VO {$vo}, user {$userdn}\n";
    }
}