#!/bin/bash

##############################################################################
# An rclone backup script by Anuj Subedi (struggleage@gmail.com).
# 
# Copyright (C) 2020 Anuj Subedi <struggleage@gmail.com>
#
# This script is licensed under the terms of the MIT license.
# https://opensource.org/licenses/MIT
#
# Runs the 'rclone sync' command.  Designed to be used as a cron job.
#
# 1) Backup Source
#    In our case backup source is dir /home/backup/
#
# 2) Backup Destination
#    This particulat script sync datas to BackBlaze B2 cloud
# 
# 3) Logs:
#    Logs can be found in this dir /home/sysadmin/backup/logs/
#   
##############################################################################

# rclone source to sync

SRC_DIR='/home/backup'

# rclone remote storage

REMOTE_PATH='b2:cp-dirname'

# rclone sync log path 

RCLONE_LOG='/home/sysadmin/backup/logs/rclone-sync-backblazeb2-daily.log'


###################################################
## 
## Let's run the sync command here 
##
###################################################

/usr/bin/rclone sync $SRC_DIR $REMOTE_PATH --log-file=$RCLONE_LOG --log-level INFO


# Once job is done. Let's exit the script 

exit