This is NOT a problem with rclone per se, only a technique for using it. This problem is "solved". But it was previously posted (as I've pasted) in 2021 - and automatically closed - essentially unsolved. I found a MUCH simpler solution that I want to share. Maybe you can post this solution there to avoid duplicate posts.
Is there a way to disable writes to a directory until the RCLONE is properly mounted under Linux?
My program does not know or care if RCLONE is mounted and will just write into the directory which in this case is the local disc.
Now Rclone service is started errors because there is stuff in the said directory. The option allow non empty is a problem because of conflicting files i assume?
End Original Post
NOTE AND UPDATE! - I had this problem and the previous thread was closed with only a complex and not useful solution - thus unsolved - for somebody of my skill level. But I found a simpler (much simpler) solution that I want to share for other novices like me:
SO HERE'S WHT YOU CAN DO TO SOLVE THIS PROBLEM:
- Put a file of a unique name that nobody nor program will ever use in Google Drive. In my case it was in the Google Drive root folder named "Do_NOT_Delete_Me_Or_You_Break_rclone.txt"
- Have your program check for the existence of that file before you write to your rclone mounted folder.
Example program in bash file:
if test -f ~/gdrive/Do_NOT_Delete_Me_Or_You_Break_rclone.txt
echo "File exists."
echo "Did NOT transfer files to gdrive because it appears to be not mounted"
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 6.2.0-34-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.21.1
- go/linking: static
- go/tags: none
I simply want to write to my gdrive folder - but ONLY when the rclone mount is successful. ex from a bash file: cp /home/$USER/DepthSensor/LLL_DepthHistory.txt ~/gdrive/'Directed'
Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.
[GoogleDrive] type = drive scope = drive token = XXX team_drive = ### Double check the config for sensitive info before posting publicly
No log. Thank You