Automatically mount Google Drive fails

"rclone mount joy_drive: /home/google_drive --allow-other"
do this ?

yes, run the mount command.

it just run and doesn't give me reation

good,
now do a ls /home/google_drive

I need ctrl+c to finished running,and do "ls /home/google_drive" ?

I do , and it doesn't give me reaction

no, that rclone mount command has to continue running all the time.

so open a new terminal window and run ls /home/google_drive

ok , it display folder name "test" in joy_drive

image

great, the mount command works!!!

When I reboot , it can auto connection to joy_drive?

you need to use systemd or cron.

https://github.com/rclone/rclone/wiki/Systemd-rclone-mount

Sorry , I still have questions
I used the code with github , but when I try

systemctl --user daemon-reload

it said "Failed to connect to bus: 沒有此一檔案或目錄"

My dbus is in '/etc/init.d

better to use this that the wiki link
https://github.com/animosity22/homescripts/blob/master/systemd/rclone.service
and you need to post the systemd service file

I try and modify code(strong words) :

[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/opt/rclone/rclone.conf
KillMode=none
RestartSec=5
ExecStart=/usr/bin/rclone mount joy_drive: /home/google_drive
--allow-other
--dir-cache-time 1000h
--log-level INFO
--log-file /opt/rclone/logs/rclone.log
--poll-interval 15s
--umask 002
--user-agent randomappname101
--rc
--rc-addr :5572
--rc-no-auth
--cache-dir=/cache
--vfs-cache-mode full
--vfs-cache-max-size 500G
--vfs-cache-max-age 336h
--bwlimit-file 16M
ExecStop=/bin/fusermount -uz /home/google_drive
ExecStartPost=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr 192.168.43.xx:5572 _async=true
Restart=on-failure
User=root
Group=root

[Install]
WantedBy=multi-user.target

And it said:
root@raspberrypi:/home/pi# systemctl daemon-reload
root@raspberrypi:/home/pi# systemctl start rclone
Job for rclone.service failed because the control process exited with error code.
See "systemctl status rclone.service" and "journalctl -xe" for details.
root@raspberrypi:/home/pi# systemctl status rclone.service
● rclone.service - RClone Service
Loaded: loaded (/usr/lib/systemd/system/rclone.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2020-10-31 21:37:29 CST; 3s ago
Process: 4325 ExecStart=/usr/bin/rclone mount joy_drive: /home/google_drive --allow-other --dir-cache-time 1000h --log-level INFO --log-file /opt/rclone/lo
Main PID: 4325 (code=exited, status=1/FAILURE)

10月 31 21:37:29 raspberrypi systemd[1]: rclone.service: Main process exited, code=exited, status=1/FAILURE
10月 31 21:37:29 raspberrypi systemd[1]: rclone.service: Failed with result 'exit-code'.
10月 31 21:37:29 raspberrypi systemd[1]: Failed to start RClone Service.

really, not sure.

did you look at the rclone log file?

where can I find "rclone log file"?

look at your command for that answer

I try " systemctl status rclone.service", and it say:
● rclone.service - RClone Service
Loaded: loaded (/usr/lib/systemd/system/rclone.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2020-10-31 21:37:29 CST; 3s ago
Process: 4325 ExecStart=/usr/bin/rclone mount joy_drive: /home/google_drive --allow-other --dir-cache-time 1000h --log-level INFO --log-file /opt/rclone/lo
Main PID: 4325 (code=exited, status=1/FAILURE)

10月 31 21:37:29 raspberrypi systemd[1]: rclone.service: Main process exited, code=exited, status=1/FAILURE
10月 31 21:37:29 raspberrypi systemd[1]: rclone.service: Failed with result 'exit-code'.
10月 31 21:37:29 raspberrypi systemd[1]: Failed to start RClone Service.

And I try "journalctl -xe",it say:
10月 31 21:53:45 raspberrypi systemd[1]: rclone.service: Service RestartSec=5s expired, scheduling restart.
10月 31 21:53:45 raspberrypi systemd[1]: rclone.service: Scheduled restart job, restart counter is at 333.
--Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- Automatic restarting of the unit rclone.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
10月 31 21:53:45 raspberrypi systemd[1]: Stopped RClone Service.
-- Subject: 單位 rclone.service 已關閉結束
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- 單位 rclone.service 已關閉結束。
10月 31 21:53:45 raspberrypi systemd[1]: Starting RClone Service...
-- Subject: 單位 rclone.service 已開始啟動
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- 單位 rclone.service 已開始啟動。
10月 31 21:53:46 raspberrypi rclone[5587]: Failed to open log file: open /opt/rclone/logs/rclone.log: no such file or directory
10月 31 21:53:46 raspberrypi systemd[1]: rclone.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- An ExecStart= process belonging to unit rclone.service has exited.

-- The process' exit code is 'exited' and its exit status is 1.
10月 31 21:53:46 raspberrypi systemd[1]: rclone.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- The unit rclone.service has entered the 'failed' state with result 'exit-code'.
10月 31 21:53:46 raspberrypi systemd[1]: Failed to start RClone Service.
-- Subject: 單位 rclone.service 已失敗
-- Defined-By: systemd
-- Support: https://www.debian.org/support

-- 單位 rclone.service 已失敗。

-- 結果為 failed。

that is where the rclone log file is.

you need to take some time to understand your rclone command and read about each and every flag in the command.

I finally success!!! Appreciate you spent your time helping me to solve this problem.

great!

what change did you make to finally get it working?