3

I submitted a job several days ago, and it is still running now. But I forget the content of that script.sh that day. And the script.sh has been deleted. Do you know how to recover the content of that script?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Jingnan Jia
  • 1,108
  • 2
  • 12
  • 28

1 Answers1

4

With recent versions, you can retrieve the job script for your own jobs with

scontrol write batch_script <job_id> <optional_filename>

From the man page:

Write the batch script for a given job_id to a file or to stdout. The file will default to slurm-<job_id>.sh if the optional filename argument is not given. The script will be written to stdout if - is given instead of a filename. The batch script can only be retrieved by an admin or operator, or by the owner of the job.

On older versions, the write batch_script command does not exist, but you can get the script with

scontrol show -ddd job <job_id>
damienfrancois
  • 52,978
  • 9
  • 96
  • 110