Rclone mount check script ERROR

I have no idea about Linux but somehow got my own server running lol, thanks to peoples scripts and by copy pasting things and using google sometimes. I just tried to activate https://github.com/ajkis/scripts/blob/master/rclone/rclone-mount-check.sh but i am getting the following error:

15.07.2019 00:13:01 ERROR: /home/mnt/gdrive not mounted, remount in progress.
15.07.2019 00:13:03 CRITICAL: Remount failed.

This is what I edited on the script:



I did the chmod thing to the script and added the line to the cronjob and thats the error I see in the log. I literally have no idea what I was supposed to do with CHECKFILEPATH, after reading I created a txt file with nano -e mountcheck.txt and wrote this is something inside, as I read somewhere that couldnt be empty but dont know the purpose of it.

I also have the rclone mount part with /usr/local/bin/rclone mount and also get the error, same if i remove /usr/local/bin/.

What can i do?

Thanks in advance

I think you need to:

mkdir /home/mnt/gdrive

If that's where you want to mount as the directory needs to exist before you rclone can mount it.

That's a pretty old script more suited for Amazon Cloud days though as it's got some stuff not really useful in there.

Which cloud backend are you using?

Thanks for replying. The directory was already created before the script. Backend? Google Drive? Bytesized? Not sure what that means, sorry :stuck_out_tongue:

I have just changed the script from gdrive:Plex to just gdrive: then checked the log file and the error its still there every minute. But then I went to check the mount folder and instead of just the Plex content the whole directory was mounted. Went back to the script, changed it back to how i want it, so gdrive:Plex and went back to check the log , the error still coming up, but also checked the mount folder and now only my Plex content was mounted, as its supposed to be. So I am not sure if the log info is failing or if the script is re mounting my mount every minute even if its already mounted. I am so confused :frowning: lol. Not sure what do do.

Thanks for the help

Im using this one :slight_smile:


1. Change paths

2. for mount and log file & create mountchek file.

3. Add to crontab -e (paste the line bellow, without # in front)

* * * * * /home/plex/scripts/rclone-mount-check.sh >/dev/null 2>&1

Make script executable with: chmod a+x /home/plex/scripts/rclone-mount-check.sh


if pidof -o %PPID -x "rclone-mount-check.log"; then
echo "$(date "+%d.%m.%Y %T") EXIT: Already running." | tee -a "$LOGFILE"
exit 1

if [[ -f "$MPOINT/$CHECKFILE" ]]; then
echo "$(date "+%d.%m.%Y %T") INFO: Check successful, $MPOINT mounted." | tee -a "$LOGFILE"
echo "$(date "+%d.%m.%Y %T") ERROR: $MPOINT not mounted, remount in progress." | tee -a "$LOGFILE"
# Unmount before remounting
while mount | grep "on ${MPOINT} type" > /dev/null
echo "($wi) Unmounting $mount"
fusermount -uz $MPOINT | tee -a "$LOGFILE"
cu=$(($cu + 1))
if [ "$cu" -ge 5 ];then
echo "$(date "+%d.%m.%Y %T") ERROR: Folder could not be unmounted exit" | tee -a "$LOGFILE"
exit 1
sleep 1
rclone mount
--dir-cache-time 48h
--vfs-read-chunk-size 16M
--buffer-size 16M

while ! mount | grep "on ${MPOINT} type" > /dev/null
    echo "($wi) Waiting for mount $mount"
    c=$(($c + 1))
    if [ "$c" -ge 4 ] ; then break ; fi
    sleep 1
if [[ -f "$MPOINT/$CHECKFILE" ]]; then
    echo "$(date "+%d.%m.%Y %T") INFO: Remount successful." | tee -a "$LOGFILE"
  echo "$(date "+%d.%m.%Y %T") CRITICAL: Remount failed." | tee -a "$LOGFILE"


Just change your paths to your setup :slight_smile:

1 Like

You also need to make the file first mountcheck.txt

in ssh write touch mountcheck.txt

Then you need the file at your cloud provider.. Google.. amazon.. etc..

If your drive is called Gdrive , then you write in ssh rclone copy mountcheck.txt Gdrive:

Once its there, then you can mount your drive to the local folder .. ex: /home/youruser/mnt/

When you mount to your /home/youruser/mnt, then you will see the file in there, and thats where the script will look for the mountcheck.txt file . If its not there, then the script will remount :slight_smile:

1 Like

Updated the paths to your setup :slight_smile:

But I doubt it would work, unless your user is named "mnt" at your mnt folder?

Normally the path would be /home/yourusernamehere/mnt/gdrive

1 Like

By backend, I mean what cloud proivder are you plugging rclone into? I am guessing by your response it would be google drive as the cloud storage provider.

As you go through, I'd probably take a few steps back rather than using someone else's scripts and start simple and try to get a basic understanding of how the commands work and what you are doing.

You took a huge leap in grabbing a Linux box and taking the plunge forward so may as well continue the journey!

Once you go through and configure a remote, you need to create a directory that is going to be the placeholder where the remote is going to get mounted.

I made a test folder and just did a simple mount command with using many of the defaults.

So in my case, my remote is an encrypted remote in my config called "gcrypt:" and I made a folder in my home directory called /home/felix/testmount and mounted it to there.

From the Windows side, it's no different than making a drive letter for a new drive.

1 Like

Thank for a very nice a detailed help message. Its still not working for me. Well, its actually re-mounting whenever I reset the seedbox but the error message keeps being logged.

You are right, the paths I entered were not complete. For some reason decided to edit those a bit after searching for help prior to posting and understood some people saying it was better to leave that part out :stuck_out_tongue: but well, not sure if it was important.

The path to the mount is /home/hd32/nissim/mnt/gdrive and the rclone is gdrive: but I use gdrive:Plex as i dont want the rest of the drive mounted. So i entered the paths you showed me based on that and nothing. Is the code below that different than the one I linked in my first message?


I did the touch mountcheck.txt then rclone copy gdrive:Plex, checked log files and error was still there. I also did rclone copy gdrive: just in case it needed to be in the root.

Thanks for taking the time do explain of all that, taking the screenshot and the rest. Very nice of you :slight_smile: That part is working for me. I am just fighting to get the script from the link to work properly, at the moment it seems to be re mounting as its supposed to but the log keeps saying error.

When you created your Googledrive in rclone config, did you create the drive with a sub path?
Or did you create the drive with root of your gdrive? IF you added Plex to your Gdrive, then you need to get the root id from Google for that specific folder.

If you wrote Plex there, then it wont work. :slight_smile:

If you open your Googledrive via your web browser, and if you have created your Plex folder there, go info the folder and take the jiberish ID from the adress field:
Should be something like:

When its asking for root id when you create the drive, you normally just press enter, but I think in your case you added Plex, and that wont work.

You need to add your Folder ID 0BWSFS_WFDWHJK128782375435BLABLABLABLA ( just an example, dont use this :slight_smile: hehe )

If you remake your drive and add the folder ID, then it should work if the mountcheck.txt file is copied to the folder on gdrive :slight_smile:

I am sorry for the delayed response and thanks for trying to help me.

Nope, I didnt do anything special. I left as default, juck click enter. But when I meant I write Plex is in the rclone command gdrive:Plex to avoid mounting the other folders not related to plex that I have in the main directory.

The code keeps re mounting, because I have restarted the seedbox several times and the mount is right back up. I just dont why the error message in the log :thinking:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.