How to use RCLONE with CRON?

Hello! I installed the Rclone program on the VPS to synchronize files from the /backup folder to the Google Drive cloud storage.
How do I set up a job in the CRON of the Hestia panel to execute a sync command?
I add the command to the CRON job:
/usr/bin/rclone sync --update --verbose --transfers 30 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s "/backup" "gdrive:HestiaCP"

but it doesn’t work. If I run the command via the commandline as root, then the sync works.

Could be to long, I would suggest to place your rclone part into a script, like:

/usr/local/bin/hestia-rclone

Sample content:

#!/bin/bash
/usr/bin/rclone sync --update --verbose --transfers 30 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s "/backup" "gdrive:HestiaCP"

Just don’t forget to make it executable: chmod +x /usr/local/bin/hestia-rclone

Then add just /usr/bin/local/rclone to your cron and it should work :slight_smile:.

5 Likes

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