- Install rclone:
$ curl https://rclone.org/install.sh | sudo bash
- Configure rclone:
$ rclone config
- Install git:
$ sudo apt-get install git
- Clone the following repo into home dir:
$ git clone https://github.com/wolfv6/rclone_jobber.git
- Create a script for the cron job by copying the following code and don't forget to replace source and dest:
$ touch rclone_cron.sh
#!/usr/bin/env sh
source="/home/muriz"
dest="mygoogledrive:UBUNTU"
move_old_files_to="dated_directory"
options="--transfers 6"
$rclone_jobber/rclone_jobber.sh "$source" "$dest" "$move_old_files_to" "$options" "$(basename $0)"
- Make the file executable:
$ chmod a+x rclone_cron.sh
- Add the script to a cron job and paste the following line (and dont' forget to replace the file path):
$ crontab -e
15 2,14 * * * /home/muriz/rclone_cron.sh >/dev/null 2>&1
Note: 15 2,14 indicates that the cron job will start every day at 02:15 and 14:15, thus making two backups per day.
Change the argument according to your needs. Helpful guide is available under: https://www.ostechnix.com/a-beginners-guide-to-cron-jobs/