Hi! I'm trying to use
rclone mount as part of a larger system, where I'd first like to mount a remote, then start using it immediately from some other code.
The problem I'm facing is that after starting
rclone in the background, the mount point takes some unknown amount of time to initialize. In the meantime I need to wait before running any code which depends on the mount being available.
The problem is knowing how long to wait; ideally we'd wait for an event from
rclone and there would be an OS-independent way to detect when the mount point is ready. So far I've found that the systemd integration seems to be approximately the right thing; if I supply a
NOTIFY_SOCKET and read from it with netcat:
nc -lk -U -u /some/socket/path
followed by running
export NOTIFY_SOCKET=/some/socket/path rclone mount remote_name: mountpoint --read-only --vfs-cache-mode=full
after doing this we'll see
READY=1 come down the socket.
I'm not sure this will work on windows though, as the use of "unixgram" in the following doesn't look promising. However, it's necessary to use "unixgram" to get a UDP socket opened for systemd compatibility, as in the C system call
socket(AF_UNIX, SOCK_DGRAM, 0).
It appears that connectionless UDP unix domain sockets as in the
nc command above are a somewhat unusual thing, possibly not accessible via
libuv which I'm using using for IO.
So what to do? In principle it seems possible to generalize the systemd stuff in a small way such that it would work on windows. Alternatively I was hoping that
rclone rc might help out in some way, but I wasn't sure exactly how to do that. Perhaps I'll try
rclone rc mount/mount next and hope that it blocks until the mount is ready.
In this case I've been testing
remote_name with a google drive remote, but I doubt the particular remote config makes much difference.
rclone version information:
rclone v1.53.1 - os/arch: linux/amd64 - go version: go1.15