I want to run complex scripts. Any advice?

The scheduler we use on our HPC platforms is SLURM. You may want to look at the documentation at: http://slurm.schedmd.com/documentation.html

We have a tutorial on scripting at: http://geco.mines.edu/scripts. Subjects include:

The HPC Tech Reports page at: http://geco.mines.edu/files/userguides/techReports has a link to:

Chaining jobs in Slurm and dealing with script errors

This note discusses how you can set up dependencies in slurm jobs so a second job waits for a first to finish before automatically starting. In particular, this shows how to set it up so that if the first job fails then the second will not start.