Skip to content

Commit

Permalink
quote variables (towards #26)
Browse files Browse the repository at this point in the history
stop any weird errors occuring if the log location contains spaces
  • Loading branch information
Scott Warchal authored and Scott Warchal committed Feb 13, 2018
1 parent 7a6f8ff commit 110be16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cptools2/generate_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ def make_logfile_text(logfile_location, job_file, n_tasks):
fi
LOG_FILE_LOC={logfile_location}/{job_file}.log
echo "`date +"%Y%m%d %H:%M"` $JOB_ID $SGE_TASK_ID $RETURN_STATUS" >> $LOG_FILE_LOC
NUM_FINISHED_JOBS=$(cat $LOG_FILE_LOC | wc -l)
echo "`date +"%Y-%m-%d %H:%M"` "$JOB_ID" "$SGE_TASK_ID" "$RETURN_STATUS"" >> "$LOG_FILE_LOC"
# if the final job has finished then send an email to the user
NUM_FINISHED_JOBS=$(cat "$LOG_FILE_LOC" | wc -l)
if [[ $NUM_FINISHED == {n_tasks} ]]; then
echo "" | mailx -s "cptools2: {job_file} analysis completed successfully "[email protected]""
echo "" | mailx -s "cptools2: {job_file} analysis completed" ""[email protected]"
fi
""".format(logfile_location=logfile_location,
job_file=job_file,
Expand Down

0 comments on commit 110be16

Please sign in to comment.