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?
Scenario:
Proxmox server is coming up where directory /mnt/mrplex is entered as store. Proxmox likes to have its own file structure and happily writes it. A few seconds later systemd is starting mrplex.service and errors out because the directory is not empty. To proceed I remove all contents written by Proxmox in the /mnt/mrplex directory and restart the service. Everything is working until the rclone mount is offline upon which point i have todo the same again.
//
DEBIAN buster
systemd mounts an encrypted Gdrive Folder to directory /mnt/mrplex
hey thanks for your reply. my systemd looks very similar to the one you posted.
But i dont see how that is solving my problem dont get me wrong i am able to succesfully mount with rclone. But in the time that it is not mounted i want no other program to be able to write into the directory.
[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target
If proxmox is started via a systemd unit (e.g. proxmox.service) then you could create a local config for it in /etc/system/proxmox.service.d/local.conf (make sure the ".d" name matches the service file name).
In it put the lines
[Unit]
RequiresMountsFor=/mnt/mrplex
Now proxmox shouldn't(!!) start until the mount has completed.
(At least that's the directory for CentOS 7; I assume Debian puts it in the same place!)
In my case (non-rclone related) I need xinetd to start after a specific NFS mount has completed so I have