Help rclone copy

Hi

I´m new to rclone.
I install it and I have onedrive configured.

I want to backup from my vpn my site to onedrive.

$ rclone copy /home/user/websitebackup/ onedrive: /websitebackup-onedrive
but always have error

Usage:
rclone copy source:path dest:path [flags]

Flags:
-h, --help help for copy

Use “rclone [command] --help” for more information about a command.
Use “rclone help flags” for to see the global flags.
Use “rclone help backends” for a list of supported services.
Command copy needs 2 arguments maximum

help please

Looks like you have a space after the remote name. I don’t think you need the first slash either.

rclone copy /home/user/websitebackup/ onedrive:websitebackup-onedrive
1 Like

Thank you ! it works!

can i make a cronjob with this?

Sure.

cron is a little picky at times as you don’t usually get all your environment variables so it might require a little trial and error.

For a simple example, I use a script like this to clean up my trash every night on my Google Drive. I have to put my environment variable for where my rclone is in the script.

felix@gemini:~$ cat /home/felix/scripts/rclone_cleanup
#!/bin/bash
# RClone Config file
RCLONE_CONFIG=/data/rclone/rclone.conf
export RCLONE_CONFIG

/usr/bin/rclone cleanup GD:
1 Like

Ok.

I have to study a little more about rclone. I use virtualmin and I want to backup the virtualmin site backup into onedrive. I have 1TB onedrive, But Im trying to get how I can remove older backups after 30 days.

Thanks for all your help!

rclone doesn’t really handle backups so well. You can use the --backup-dir command to move ‘replaced’ files to a backup directory while keeping your location you sync’ed to ‘current’. You can’t really tell it to remove older backups unless you structure it yourself.

You could also backup to a folder everytime with a date name and then write a bash script to remove directories older than ‘X’ days with the caveat that you’ll be backing up that TB every time. Thats a lot of wasted data. Just depends on what you want to do.

If you want a full flegged backup using rclone as a backend, i’d suggest you look at ‘restic’ which can use rclone as a backend and give you real backup sets.

1 Like

Im trying to understand why script works by running on shell and on cronjob not?

#!/bin/bash
if pidof -o %PPID -x “rclone-cron.sh”; then
exit 1
fi
rclone sync /home/user/WebSitesBackup/ onedrive:WebSitesBackup-segjar
exit

crontab -e
*/5 * * * * /home/user/rclone-cron.sh >/dev/null 2>&1

crontab is annoying as you don’t get full paths.

so you’d need to change rclone to /usr/bin/rclone assuming that is where it is installed.

felix@gemini:~$ which rclone
/usr/bin/rclone
1 Like

Thank you !!!

is in

/usr/local/bin/rclone