Auto serve ftp on reboot in rclone

I have established a serve FTP connection with Google Drive with the following command in rclone:

rclone serve ftp hello-drive:/ --user new --pass new

but after the system reboots, I have to run that command again. That's why I wrote this file to re-run serve FTP in this directory /etc/systemd/system/gdrive.service:

[Unit]
Description=rclone for hello-drive
AssertPathIsDirectory=/
After=networking.service

[Service]
Type=simple
ExecStart=rclone serve ftp --config=/home/root/.config/rclone/rclone.conf hello-drive:/ --user new --pass new

ExecStop=/bin/fusermount -u /
Restart=always
RestartSec=10

[Install]
WantedBy=default.target

I can enable it, but when I try to start it with this command

systemctl start gdrive.service

I got this error:

Failed to start gdrive.service: Unit gdrive.service is not loaded properly: Exec format error.

hello and welcome to the forum,

ExecStop=/bin/fusermount -u /
perhaps the issue is the trailing slash, perhaps remove that.

if not, we have systemd experts and one should stop by soon.

here in the forum, this is a goto example for a systemd service.
https://github.com/animosity22/homescripts/blob/master/systemd/rclone.service

You don't want this for rclone serve ftp - just remove the line.

This usually means that the thing you are trying to run (rclone) is not executable, or maybe not found - try putting in a full path in, or you downloaded the wrong type of binary (amd64 for an arm64 machine).

Thanks sir
I was cleaned that line, but issue not resolved. Can you look at gdrive.service file again. I think the gdrive.service file is wrong. Or do you have any ideas about this issue?

Thanks my friend
That systemd service is written about mounting on rclone, can you write it for serve ftp?

well, not an expert at linux and systemd; i do not know why your service file is not working.
we do have experts and hopefully one will stop by soon.

in the mean time, in the past, i have taken that service file i shared and got it working for my use-case.

so i would try a very simple service file, get that working and then tweak from there.

  1. remove ExecStop
  2. remove ExecStartPost
  3. change ExecStart to /usr/bin/rclone version
  4. change this as needed
User=felix
Group=felix

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