ClearOS Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0018581ClearOSapp-flexshare - Flexsharespublic2018-01-12 10:352018-02-21 09:26
Assigned To 
PlatformOSOS Version
Product Version7.4.0 
Target VersionFixed in Version 
Summary0018581: Add menu option to clear .trash items older than x days from flexshares
DescriptionCurrently, if you enable the recycle bin on Flexshares, deleted files build indefinitely in the .trash folders, eventually possibly filling the file system.

I think that there should be a user-configurable parameter for the number of days of old files to keep. This dropdown or input box could perhaps only be exposed if the recycle bin is enabled. A cron job could then be set up with something like:

tmpwatch 30d --all -m -q /var/flexshare/shares/*/.trash/

in it. Obviously change the 30d to however many days are chosen in the UI. The cron job may also have to take care of the custom flexshare location.

Note the more commonly touted solution is to use the following lines:
find /shares/*/.trash/ -type f -mtime +30 -exec rm -f {} \;
find /shares/*/.trash/ -type d -empty -exec rmdir {} \; > /dev/null 2>&1

but this can take a few days to delete a folder structure. Not a big issue but tmpwatch is neater.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
NickH (developer)
2018-01-13 03:28

Note the cron job would have to be a bit more detailed than my one-liner. The Recycled bin is enabled on a per-flexshare basis so the .trash would also need to be cleared on a per-flexshare basis as it would be possible to set different retention periods per flexshare.

- Issue History
Date Modified Username Field Change
2018-01-12 10:35 NickH New Issue
2018-01-13 03:28 NickH Note Added: 0006961
2018-02-21 09:26 pbaldwin Status new => acknowledged