Page 1 of 1

Overwrite file by scheduler task

Posted: 06 Feb 2018, 14:42
by chricken
Hi,

I have an issue with a scheduler task here:
I am using the scheduler task 'product export', which works fine now.
I get a file, which contains the expected data. Unfortunately the data is being appended to the existing file.
Is there any way to force the script to overwrite the file?

My secondbest idea would be to delete the file a few minutes before it is being written. That'd be okay in my workflow but it is not really clean and beautyful.

Thank you, regards
Christian

Re: Overwrite file by scheduler task

Posted: 07 Feb 2018, 10:57
by aimeos
Overwriting the files is not the best idea because this can lead to inconsistencies if they are read and updated at the same time. What would be possible is to add a timestamp to each file so they are not appended any more.

Re: Overwrite file by scheduler task

Posted: 09 Feb 2018, 05:54
by chricken
Thanks for your answer,
that's a good objection and i understand, why that is not standard behaviour.

Therefore I already solved that problem by having a second cronjob, which deletes the old file one hour before the new one is generated. For my special usecase, this works perfectly.

Re: Overwrite file by scheduler task

Posted: 09 Feb 2018, 12:59
by aimeos
The next version will contain the date by default in the file name and the file name template will be configurable so you can decide about the naming of the exported files.