[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] cluster number in shell script (sh)

On 11/29/2010 05:13 PM, Steven Timm wrote:
yes, set
Yes, I know about $(cluster). The problem is that I want to know the cluster number generated by a condor_submit command called in a shell script like this:

#!/bin/sh -f
mkdir $LOGDIR

echo "Universe=vanilla" >> ${job}
echo "Executable=/bin/exe" >> ${job}
echo "Input=/dev/null" >> ${job}
echo "Output=${LOGDIR}/out.\$(Process) " >> ${job}
echo "Error=${LOGDIR}/err.\$(Process) " >> ${job}
echo "log=${LOGDIR}/log " >> ${job}
echo "transfer_executable=yes" >> ${job}
echo "when_to_transfer_output = ON_EXIT" >> ${job}

for ((j=1;j<1000;j++)) ; do
    echo "Arguments=${arg} $j" >> ${job}
    echo "Queue" >> ${job}
    echo "" >> ${job}
    nn=`expr $nn + 1`

condor_submit ${job}


Here I want to know the cluster number in order to regroup all the Output and Error files in one file named $(cluster).log
For the moment the only ideea I have is to parse the output of condor_submit like this:

c_submit=`condor_submit ${submit}`
if [ ${exit_status} != 0 ]; then
    exit ${exit_status}
cluster=`echo ${c_submit} | grep "submitted to cluster" | awk '{print $NF}' `

but this is dependent on the output of the condor_submit command which could change in other version of Condor.

I want to use the cluster number because it is unique (unlike $$ which is the PID of the shell and for sure will be reused by the system).

Best regards,

in your condor submit file
and the log file will be created accordingly.

Steve timm

On Mon, 29 Nov 2010, Alexandru Chiscan wrote:

   Hello all,

I am using shell scripts to generate condor submit files and to submit
The scripts generate clusters with many jobs (hundreds) and I want at
the end to have in one log file the output and the error log of all the
jobs in the cluster. For the moment I am using the shell name and pid
for the log name ( $0.$$ ) but the pid will be reused and I will like to
use the cluster number for it - which should be unique (or not?).

Is there any way to get the cluster number in the script without having
to parse the output of the condor_submit command?

cluster=`condor_submit job.submit | grep "submitted to cluster" | awk
'{print $6} `
echo "cluster $cluster"


Condor-users mailing list
To unsubscribe, send a message to condor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting

The archives can be found at: