cd ~
mkdir OneDrive
Then, I have used systemd to create service which mounts my OneDrive folder. Commandsystemctl --user edit OneDrive
creates service file in ~/.config/systemd/user/OneDrive.service and I have filled it with my gist:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=OneDrive (rclone mount) | |
Wants=network-online.target | |
After=network.target network-online.target | |
[Service] | |
Type=notify | |
Restart=on-failure | |
ExecStart=/usr/bin/rclone --vfs-cache-mode writes mount OneDrive: %h/OneDrive --config %h/.config/rclone/rclone.conf --no-modtime | |
ExecStop=fusermount -u %h/OneDrive | |
[Install] | |
WantedBy=default.target |
Then I have enabled OneDrive service to run on login:
systemctl --user enable OneDrive
To run it immediately, You can issue the command:systemctl --user start OneDrive