Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it configurable what kind of file (modification/access/change/creation) time should be used #206

Open
adybbroe opened this issue Sep 5, 2024 · 0 comments

Comments

@adybbroe
Copy link
Contributor

adybbroe commented Sep 5, 2024

Feature Request

Is your feature request related to a problem? Please describe.
I came across a problem cleaning "old" files using the remove_ut.pyscript.
Listing the files on my Linux OS said the files were from somewhere in June (different dates/times). Today it is september 5th, and I wanted to clean all files older than 72 hours. But files were not cleaned. Checking one of the files using statI saw this:

  File: ......W_XX-OHB-Kangerlussuaq,SAT,AWS1-MWR-1C-RAD_C_OHB_20240610190753_G_D_20240115111111_20240115125434_T_B____.nc
  Size: 427919493 	Blocks: 835784     IO Block: 4096   regular file
Device: 811h/2065d	Inode: 1602048     Links: 1
Access: (0644/-rw-r--r--)  Uid: (61614/safusr.t)   Gid: (62861/safusrgt)
Context: system_u:object_r:container_file_t:s0:c383,c579
Access: 2024-06-10 19:08:28.417478279 +0000
Modify: 2024-06-10 19:08:28.459482700 +0000
Change: 2024-09-03 09:19:48.426063079 +0000
 Birth: -

As the trollmoves clean script go on the ctime I thought the files should have been cleaned. But on Linux ctime is not the creation time, but:

stat.ST_CTIME

    The “ctime” as reported by the operating system. On some systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time (see platform documentation for details).

Something in my system seem to have changed the metadata in the file, though I have not actively done anything to the files there.

So, in this case it would have been better for me to use the mtime or perhaps the atime.

Describe the solution you'd like
So, we would need a way to confugure which measure should be used to determine the age of a file. So, that it is up to the user to decide. Default could be ctime.

Describe any changes to existing user workflow
Are there any backwards compatibility concerns? Changes to the build process? Additional dependencies?

Additional context
Have you considered any alternative solutions or is there anything else that would help describe your request.

@adybbroe adybbroe assigned adybbroe and unassigned adybbroe Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant