Issues with .service file

Hey all,

I appear to be having some issues trying to get the service file working correctly. As it stands if I were to run this command manually:

rclone mount --allow-other --log-level INFO --cache-db-purge --buffer-size=256M --log-file /home/td00/logs/rclone.log --vfs-cache-mode writes --dir-cache-time 24h crypt:/ ~/mnt/gdrive &

Everything works flawlessly. I can cd into my Movies folder and TV folders and see all the files there no problems. However, trying to get this into a service file so that I no longer need to do this is proving to be a bit more difficult:

[Unit]
Description=Google Drive (rclone)
Wants=network-online.target
After=network-online.target
Before=docker.service

[Service]
Type=simple
ExecStart=/usr/bin/rclone mount crypt:/ ~/mnt/gdrive \
--allow-other \
--buffer-size 256M \
--dir-cache-time 24h \
--log-level INFO \
--log-file /home/td00/logs/rclone.log \
--timeout 1h \
--cache-db-purge \
--vfs-cache-mode writes \
--dir-cache-time 24h
ExecStop=/bin/fusermount -uz ~/mnt/gdrive
Restart=on-failure

[Install]
WantedBy=multi-user.target

Now, this works as in no errors. However, when I try to cd into /mnt/gdrive there aren't the two directories I'm looking to see (Movies and TV). It's probably something silly that I'm just not seeing (hopefully).

What does:

systemcdtl status servicename

show?

Oh, it looks like you are running it as root user and you have the path as ~/mnt/gdrive, which would go to /root/mnt/drive I believe.

What user are you running the mount as?

Oh I am running as my user and not root. How did you see that it was running as root?

In the service section for the file, you'd want to put the user / group you want to run it as:

User=felix
Group=felix

Cool let me try!

And you probably want to change from simple to notify. Here is an example of mine:

[felix@gemini system]$ cat gmedia-rclone.service
[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/opt/rclone/rclone.conf

ExecStart=/usr/bin/rclone mount gcrypt: /GD \
--allow-other \
--buffer-size 1G \
--dir-cache-time 96h \
--log-level INFO \
--log-file /opt/rclone/logs/rclone.log \
--timeout 1h \
--umask 002 \
--rc
ExecStop=/bin/fusermount -uz /GD
Restart=on-failure
User=felix
Group=felix

[Install]
WantedBy=multi-user.target

OK now we're getting somewhere. Once I put that in, the log files error out and say:

2019/07/22 17:34:06 Fatal error: failed to mount FUSE fs: fusermount: exit status 1
2019/07/22 17:35:52 mount helper error: fusermount: user has no write access to mountpoint /~/mnt/gdrive

Not sure how to fix this. I've chowned ~/mnt/gdrive though my user was already listed there next to the root user and full rwx permissions.

I would tend to not use ~ as it's a relative thing. If you have a user you can replace it with /home/user/mnt/gdrive if that's what you want to use.

LOL! @Animosity022 that was it. I can't believe I get hung up on these tiny little issues. Well thanks for the help... I'm off to create the mergerfs files now!

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