From 38b6dc89a15c71b1cfee74ec6fbda5db91b4d2de Mon Sep 17 00:00:00 2001 From: karagian Date: Wed, 28 Jul 2021 18:47:08 +0300 Subject: [PATCH] Fix rclonefs script's eternal loop in case the remote is empty, by replacing ls with grep /proc/mounts. The space replacement in $mountpoint is necessary for the case where $mountpoint contains spaces --- rclone-mount-helper-script.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rclone-mount-helper-script.md b/rclone-mount-helper-script.md index fe16add..399182e 100644 --- a/rclone-mount-helper-script.md +++ b/rclone-mount-helper-script.md @@ -39,11 +39,12 @@ To enable mounting a rclone volume using system mount tool, the following helper # NOTE: mount is suid and ignores pre-set PATHs -> specify explicitely PATH=$PATH rclone mount $trans /dev/null 2>/dev/null & - # WARNING: this will loop forever if remote is actually empty! - until [ "`ls -l $mountpoint`" != 'total 0' ]; do - sleep 1 + # wait until mounting is complete + until grep -q " ${mountpoint// /\\\\040} " /proc/mounts; do + sleep 0.5 done + ## fstab In `/etc/fstab` you can add something like: