extensions/net.sf.basedb.opengrid/trunk/src/net/sf/basedb/opengrid/engine/direct/submit.sh

Code
Comments
Other
Rev Date Author Line
6629 07 Mar 22 nicklas 1 #!/bin/bash
6614 28 Feb 22 nicklas 2 ##
6614 28 Feb 22 nicklas 3 ## This script is used to start a job in the background
6614 28 Feb 22 nicklas 4 ## and return the JOB_ID to the caller.
6614 28 Feb 22 nicklas 5 ## Options/parameters for the job are expected to be
6614 28 Feb 22 nicklas 6 ## in the file that is given as the only parameter.
6614 28 Feb 22 nicklas 7 ##
6614 28 Feb 22 nicklas 8
6614 28 Feb 22 nicklas 9 ## JOB ID is the process id of the current script
6614 28 Feb 22 nicklas 10 export JOB_ID=$$
6614 28 Feb 22 nicklas 11 export JOB_OPTIONS=$1
6614 28 Feb 22 nicklas 12
6614 28 Feb 22 nicklas 13 ## Read other parameters
6614 28 Feb 22 nicklas 14 source ${JOB_OPTIONS}
6614 28 Feb 22 nicklas 15
6614 28 Feb 22 nicklas 16 ## Write status information
6639 11 Mar 22 nicklas 17 echo "Name: ${JOB_NAME}" > ${STATUS_FILE} 
6614 28 Feb 22 nicklas 18 echo "Host: `hostname`" >> ${STATUS_FILE}
6614 28 Feb 22 nicklas 19 echo "Submitted: `date +'%Y-%m-%d %T'`" >> ${STATUS_FILE}
6614 28 Feb 22 nicklas 20
6614 28 Feb 22 nicklas 21 ## Start job.sh in the background
6639 11 Mar 22 nicklas 22 nohup /bin/bash ${WD}/run.sh > ${SGE_STDOUT_PATH} 2> ${SGE_STDERR_PATH} &
6614 28 Feb 22 nicklas 23
6614 28 Feb 22 nicklas 24 ## Returns the job id to the submitter
6614 28 Feb 22 nicklas 25 echo ${JOB_ID}