[gridengine users] How to overwrite instead of append to output?

Reuti reuti at staff.uni-marburg.de
Wed Jan 14 01:19:11 UTC 2015


Am 14.01.2015 um 01:03 schrieb Amos Anderson:

> I'm trying to set up a StarCluster system which uses Open Grid Scheduler OGS/GE 2011.11p1. When I run a submission script like this:
>    #!/bin/bash
>    #$ -N jobname
>    #$ -o jobname.out
>    #$ -j y
>    #$ -S /bin/bash
>    #$ -V
>    #$ -cwd
>    #$ -l h_cpu=1:0:00
>    #$ -l mem_free=2000M
> output is being appended to `jobname.out` instead of overwriting the file. I would have expected the file `jobname.out` to be overwritten because that's the behavior I'm used to from torque PBS scripts (and LSF although I can't verify that easily at the moment). Regardless, I can't find any discussion of this in the documentation for `qsub`. The only help I found is [ancient][1], and it suggests manually putting something in the queue prolog. Is that still the easiest approach?

I can't come up with anything new here. It's a matter of taste what behavior you prefer.

The output in Torque is overwritten (AFAIK) as only *after* the job the temporary output/error files are copied to the final destination. SGE writes live to the files in question. As several steps during job execution can produce output (prolog, jobscript, epilog), it can only be appended.

Instead of removing the file you can also empty it by a null command in the prolog by bash:


This can also be expanded to check for any job context or set environment variable during prolog execution to give the users the option to specify something like `qsub-v disposition=new ...` resp. "disposition=mod" / "disposition=old" and act accordingly in the prolog.

-- Reuti

More information about the users mailing list