Skip to content

Exercise 2d: Standard Input within a Job

For executables requiring standard input, HTCondor provides an option to specify the input file to pipe into the executable.

We can adjust the script.sh script as follows in order to demonstrate this functionality:

#!/bin/bash
for i in {1..3}; do
  echo "Enter input $i: "
  read input
  echo "You have entered: $input"
done
We can set the input.txt file to contain the following:
apples
oranges
avocado
Finally, the submission script exercise2d.md can be defined as shown below:
executable              = script.sh
input                   = input.txt
output                  = out.$(ClusterId).$(ProcId)
error                   = err.$(ClusterId).$(ProcId)
log                     = log.$(ClusterId).$(ProcId)
queue
Execute condor_submit exercise2d.md to submit the job. When the job has finished running, you can check that the following output was generated:
Enter input 1: 
You have entered: apples
Enter input 2: 
You have entered: oranges
Enter input 3: 
You have entered: avocado


Last update: November 26, 2019