<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    I put this line in my job-control file (written in <tt>bash</tt>)
    to capture the original as part of the run:<br>
    <blockquote><tt>cp $0 $RUNDIR/$SLURM_JOB_NAME</tt><br>
    </blockquote>
    The <tt>$0</tt> gives the full path to the working copy of the
    script, so it expands to this for example:<br>
    <blockquote><tt>/fs/slurm/var/spool/job67842/slurm_script</tt><br>
    </blockquote>
    It depends on this spooling directory being readable by all users.<br>
    This may not be the case on all systems.<br>
    If not, there might be a way to make it readable to just the owner
    of the job, you'd have to talk to the SLURM developers about that.<br>
    <br>
    Also I'm not setting the jobname, so the <tt>$SLURM_JOB_NAME</tt>
    defaults to the name of the original script.<br>
    Otherwise, you should also be able to extract this from the
    "command" field output from <tt>squeue</tt>.<br>
    <br>
    Note that this only works because the job is still running.<br>
    But it enables me to edit-and-submit the script in rapid-fire and
    capture the original script with each of the runs.<br>
    So I can put it in the same directory where all the other output
    files go, and have a complete description of the run conditions.<br>
    <br>
    <div class="moz-forward-container"><br>
      <hr width="100%" size="2">
      <table class="moz-email-headers-table" cellspacing="0"
        cellpadding="0" border="0">
        <tbody>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Subject:
            </th>
            <td>[slurm-users] Get original script of a job</td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Date: </th>
            <td>Fri, 5 Mar 2021 10:29:58 +0000</td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">From: </th>
            <td>Alberto Morillas, Angelines
              <a class="moz-txt-link-rfc2396E" href="mailto:angelines.alberto@ciemat.es"><angelines.alberto@ciemat.es></a></td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Reply-To:
            </th>
            <td>Slurm User Community List
              <a class="moz-txt-link-rfc2396E" href="mailto:slurm-users@lists.schedmd.com"><slurm-users@lists.schedmd.com></a></td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">To: </th>
            <td><a class="moz-txt-link-abbreviated" href="mailto:slurm-users@lists.schedmd.com">slurm-users@lists.schedmd.com</a>
              <a class="moz-txt-link-rfc2396E" href="mailto:slurm-users@lists.schedmd.com"><slurm-users@lists.schedmd.com></a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.EstiloCorreo17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style>
      <table border="1" bgcolor="#FFEB9C">
        <tbody>
          <tr>
            <td><font size="1" face="verdana" color="black"><b>External
                  email: Use caution opening links or attachments</b>
              </font></td>
          </tr>
        </tbody>
      </table>
      <br>
      <div>
        <div class="WordSection1">
          <p class="MsoNormal"><span lang="EN-US">Hi, <o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">I would like to know
              if it will be possible to get the script that was used to
              send a job.<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">I know that when I
              send a job with scontroI can get the path and the name of
              the script used to send this job, but normally the users
              change theirs scripts and sometimes all was wrong after
              that, so is there any possibility to reproduce the script
              of an old job???<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal">Thanks in advance<o:p></o:p></p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <div>
            <div>
              <p class="MsoNormal"><span
style="font-size:9.0pt;font-family:Helvetica;color:black;mso-fareast-language:ES-TRAD"><br>
                  Angelines </span><span
                  style="mso-fareast-language:ES-TRAD"><o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
        </div>
      </div>
    </div>
  </body>
</html>