Added a destination space check, it is set to off by default. If enab… #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added a destination space check, it is set to off by default.
If enabled it checks that more space is available at the destination than what is set in REMOTE_FREE_SPACE (in the config) before performing a sync.
This is useful on for example a raspberry pi that has a big external mounted filesystem (zfs or sshfs), in this case if one can set REMOTE_FREE_SPACE larger than the raspberry pis local filesystem (sd-card) if the test passes one can surmise the external mount is available . This will avoids writes to the mounting point directory if the external mount is unavailable.
I fiddled a bit with reading /proc/mounts before I settled on this way of doing it. Reading /proc/mounts turned out to be more difficult than a simple size check on mounts that can have many similar roots such as ZFS. Also available free space is simple to reason around and solves my problem. (which is similar to #67 ).
But in this case this is harmless and extendable; one could overwrite the REMOTE_FREE_SPACE with something from a dry-run rsync and thereafter the check_free_space function checks that the process will not fail due to space issues. I found a dry-run takes a lot of time and it did not seem worth the performance cost for me; but if someone wants this in the future this is a building block towards that.