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

Fix cron script of recyclebin delete #55

Closed
wants to merge 1 commit into from

Conversation

Fantu
Copy link

@Fantu Fantu commented Feb 26, 2018

On server with openmediavault package 3.0.96 I found that never clean the recycle of all shares even if setted correctly (causing big problems of full disks).
After have investigated I found that /var/lib/openmediavault/cron.d/samba-recycle-* file executed manually always exit with status 0 without delete the files that must delete (even if find commands work correctly), exit with both lock dir exist and not.
This PR solves this problem (simpler and faster solution that came to my mind, already tested)
When will be applied can be backported also to 3.0.x please?

Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
@CLAassistant
Copy link

CLAassistant commented Feb 26, 2018

CLA assistant check
All committers have signed the CLA.

if ! mkdir "${lockfile}" &>/dev/null; then
exit 0
fi
[ -e ${lockfile} ] && exit 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial solution has been choosen because mkdir is atomic. With your implementation the creation and checking of the lock file is not atomic anymore because it is splitted into separate operations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem should be solved if the trap is relocated before the mkdir command. I have to check that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With actual solution script never do its work of cleaning recycle because exit always with exit status 0 before, first time creating "lockfile" and after because exist, move trap before delete the "lockfile" on exit but still exit without execute the clean, the only working solution is split create and check "lockfile" (I not know way to make it working without split)

@votdev
Copy link
Member

votdev commented Feb 27, 2018

This pull request is obsolete now. See d903f25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants