1) Create a job-script  myJobScript.sh 

Job-script contains the HPC queue settings (queue name, log-files, email, ...) and the main tool command (e.g. echo,  BLAST,  bowtie2, ... ) 

Example job-script (text file)  myJobScript.sh

#!/bin/bash

#

# SGE SETTINGS

#$ -q std.q    # queue name to which script will be submitted

#$ -N ReadAlign  # script name to be visible in the queue

#$ -o /my/new/project/log_output_$JOB_ID.txt # command output file in project path

#$ -e /my/new/project/log_error_$JOB_ID.txt  # command error message file

#$ -M my.email.address@gmail.com # to get notifications about script status

#$ -m ea # send email in case of job end or abort(error)

#$ -pe smp 8   # number of required processors

#

# TOOL COMMANDS

# go to working directory

cd /my/new/project/

# print computer name (host-name of selected cluster node)  

echo "Hello from `hostname`!"

# run main tool command

singularity exec /my/tools/bowtie2-2.5.1.sif  bowtie2 -x ecoli -1 SAMPLE_R1.fastq -2 SAMPLE_R2.fastq  --no-unal -p 8 -S SAMPLE.sam


2) Submit the job-script 

# submit a job-script  ( add “myJobScript.sh” as new job to queue “std.q” )

qsub myJobScript.sh 


3) Check status of  job-script

# check status of all my submitted jobs ( Is my job still waiting in queue or already running? )

qstat -f

# show jobs of all users  ( all running and waiting jobs)

qstat -u '*' -f  | more

  r     - job-script is running

 qw  - waiting in the queue

Eqw - Error in script, job is not executed, check possible error (disk quota, file permission, ... )

→ Check resources of the nodes in a HPC SGE cluster


4) Delete job-script

(1) get job-ID

qstat

  job-ID  priority  job-name   user   state  queue             

  12345   0.750     ReadAlign  myName  r     std.q@node2.cluster    

(2) delete job   ( remove an already submitted job-script )

qdel 12345