function writeScheduleScript(prs) {
  let script =
    `#!/bin/bash \n\n` +
    `mkdir -p ${logDir} \n\n` +
    `# Be sure you have no locally modified files in your git client before running this. \n\n`;

  // Generate a command for each file to be piped into the `at` command, scheduling it to run at
  // a later time.
  for (const pr of prs) {
    script +=
      `echo '(` +
        `cd ${localRepo} ; ` +
        `${presubmitScript} presubmit ${pr.number} --global 2>&1 > ${logDir}/pr-${pr.number}.txt ` +
      `)' | ` +
      `at ${startTime} today + ${intervalMinutes * presubmitCount} min ` +
    `\n`;

    presubmitCount++;
  }

  fs.writeFileSync(path.join(localRepo, 'dist', 'schedule-presubmit.sh'), script, 'utf-8');

  console.log('schedule-presubmit.sh written to dist');
  console.log('Be sure to prodaccess overnight, that you have no locally modified files, ' +
              'and push_tag has been run');
}
Number of intervals that have scheduled tasks already.