<div dir="ltr"><div dir="ltr">Hello again!<div><br></div><div>I had a realisation last night that I was probably truncating the previous stderr output by not supplying the -a argument to tee. After some testing this morning, I can happily say that the following script works as expected:</div><div><br></div><div>test.sh:<br><font face="monospace" color="#674ea7">#!/bin/bash<br clear="all"></font><div><font face="monospace" color="#674ea7"><br></font></div><div><font face="monospace" color="#674ea7">echo "out"</font></div><div><font face="monospace" color="#674ea7">echo "err" >&2</font></div><font face="monospace" color="#674ea7">echo "err 2" 1>&2</font><div><font face="monospace" color="#674ea7">>&2 echo "err 3"</font></div><div><font face="monospace" color="#674ea7">echo "err 4" >>/dev/stderr</font></div><div><font face="monospace" color="#674ea7">echo "err 5" 1>>/dev/stderr</font></div><div><font face="monospace" color="#674ea7">echo "err 6" | tee -a /dev/stderr</font></div></div><div><br></div><div>In the end it was on my side, but I thought I would still share in case someone else makes the same mistake.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 13, 2021 at 2:26 PM Maria Semple <<a href="mailto:maria@rstudio.com">maria@rstudio.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I have some jobs which write error messages to stderr, and I've noticed that the stderr output is not being written to file. Here is a simple reproduction case:<br><br>test.sh:<br><font face="monospace" color="#674ea7">#!/bin/bash<br clear="all"></font><div><font face="monospace" color="#674ea7"><br></font></div><div><font face="monospace" color="#674ea7">echo "out"</font></div><div><font face="monospace" color="#674ea7">echo "err" >&2</font></div><font face="monospace" color="#674ea7">echo "err 2" 1>&2</font><div><font face="monospace" color="#674ea7">>&2 echo "err 3"</font></div><div><font face="monospace" color="#674ea7">echo "err 4" >/dev/stderr</font></div><div><font face="monospace" color="#674ea7">echo "err 5" 1>/dev/stderr</font></div><div><font face="monospace" color="#674ea7">echo "err 6" | tee /dev/stderr</font></div><div><br></div><div>When I run that script through srun, the output includes all the echoes:</div><div><font face="monospace" color="#3d85c6">out<br>err<br>err 2<br>err 3<br>err 4<br>err 5<br>err 6<br>err 6</font><br></div><div><br></div><div>If I run through sbatch without separating output and error into their own files, I get only the last echo (<font face="monospace" color="#3d85c6">err 6</font><font face="arial, sans-serif">). If I run with separate output files (e.g. </font><font face="monospace" color="#674ea7">sbatch --output slurm-%j.out --error slurm-%j.err</font><font face="arial, sans-serif">), I get this:</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">slurm-<id>.out:</font></div><div><font color="#3d85c6" face="monospace">out</font></div><div><font color="#3d85c6" face="monospace">err 6</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">slurm-<id>.err:</font></div><div><font face="monospace" color="#3d85c6">err 6</font></div><div><br></div><div>I would expect to see all of the err lines in the slurm-<id>.err file. I've tested this with Slurm 20.11.05 and Slurm 21.08.0 and the behaviour is the same. Any assistance would be greatly appreciated!</div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Best Regards,<br></div>Maria<br></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Best Regards,<br></div>Maria<br></div></div></div>