205 - Submitting Your First Job
Create a simple Slurm script, submit it with sbatch, monitor it with squeue, and read the resulting output file.
Directory Setup
1. Create a folder for your first job
Run mkdir -p ~/first-job-demo and press Enter.

2. Open the first-job folder
Run cd ~/first-job-demo and press Enter.

3. Confirm your working directory
Run pwd and press Enter.

Create the Job Script
4. Open a new Slurm script in Nano
Run nano first-job.slurm and press Enter.
It will open a window as shown below.

5. Paste and Save the Slurm script as first-job.slurm
Paste the script, then press Ctrl+O and Enter to save it.


6. Exit Nano After Saving
Press Ctrl+X to exit.

Tip: Tip!
Display the file to make sure it was saved correctly:
cat first-job.slurm
Submit the Job
7. Submit the job to Slurm
Run sbatch first-job.slurm and press Enter.

8. This number is your job ID. Your number will be different!

Monitor Job Status
9. Check your job in the queue
Run squeue -u "$USER" and press Enter.

10. Check your job by its ID
Run squeue -j 5554670 and press Enter. Replace 5554670 with your job ID.

Tip: Tip!
- R means the job is running.
- PD means the job is waiting to run.
- Wait about one minute and check again. If the job no longer appears, it has left the queue.
Verify Job Output
11. Find the Slurm output file.
Run ls -lh and press Enter.

12. Read the job’s output.
Run cat first-job-5554670.out and press Enter. Replace 5554670 with your job ID.
A successful job should end with “Your first Slurm job completed successfully”
