Why isn’t rclone mounting when I close the ssh? It should be able to mount even though the ssh is not running or am i missing something here? It’s really annoying having to have an ssh client open to a headless server when having to mount constantly especially when you plan to have multiple users on the server across different timezones, where you have to have some app running the ssh client 24/7.
Apart from aaall the possibilities to run a process in the background (like &) - have you ever heard of screen (or tmux)?
If the machine is headless, and the user who started the rclone mount is only logged in via ssh, then I believe even using
& will not preserve the mount.
As seuffert mentioned, one possibility is to install tmux or screen. This will leave a shell session running in the background that you can connect to and run commands from. Effectively the user will always be logged in, as long as the tmux or screen session is running, and you should be able to re-attach to the session to terminate the mount or check status.
Another possibility (with it’s own pros and cons) which will likely not require installing any new software is to use the
nohup command, which will keep a program running even after it’s parent user has logged out. Something like
nohup rclone mount ... &
Then logging out should keep the mount running. to stop it you’ll have to run something like (Replace
$MOUNT_LOC with the directory rclone is mounting on top of, i.e. the local directory where you want the files to appear.)
fusermount -u $MOUNT_LOC
Tmux is pretty amazing though, and in administering the server, you’ll find plenty of times it will be quite handy, so I’d recommend installing it as the better option. Once installed, to create a new session, enter
tmux at the cli prompt. Then, enter your rclone mount command as desired. Next, assuming you haven’t touched the tmux configuration, you can hit the keys
d to detach from the session while leaving it running in the background. Then you can logout from ssh and it should still run. If you need to access the output of
rclone or stop it, you can later enter
tmux a to re-attach to the same session. Here’s a Cheat-Sheet that helps explain the basics of tmux.