How to mount drive with bash? (example.sh)

Hello,
I'm trying to mount Dropbox with below command. It's working if i put command in terminal, but not if i create bash file like example.sh. I tried different options, but can't find a solution. My mount file can be seen below:

#!/bin/bash
rclone mount dropbox: /mnt/dropbox/ --dropbox-chunk-size 149M & disown
echo "Dropbox mounted"

I'm on Debian linux.
Thanks for help.

hi,

might try using a log file
--log-level=DEBUG --log-file=/path/to/rclone.log
and/or
--daemon

Thank you! It's working now. You just saved my day :slight_smile:

good that it worked out

The --daemon flag probably is exactly what you wanted so I am glad it worked for you.

But there are other options if you're interested. One of the easier is to use GNU Screen (or the more modern tmux, but I don't know it as well). It basically lets you create a shell session (bash or otherwise) and disconnect. You can use flags to decide how it would work.

For example, you can do:

screen -dm rclone mount dropbox: /mnt/dropbox/ --dropbox-chunk-size 149M 

which will launch the command in the background. But you can do screen -ls to see running sessions and then screen -r <NAME/ID> to connect back to them.

This is just scratching the surface. There is so much more it can do. And, as will all things, it has pros and cons