Skip to main content

Integration

Basic Setup

bash

Copy


# Install rclone
curl https://rclone.org/install.sh | sudo bash
# Initial configuration
rclone config

Remote Configuration

bash

Copy


# Example Google Drive setup
rclone config create gdrive drive \
scope=drive \
root_folder_id=root \
service_account_file=/path/to/service-account.json
API Integration
python

Copy


import subprocess
def rclone_sync(source, destination):
cmd = [
'rclone', 'sync',
'--progress',
source,
destination
]
return subprocess.run(cmd, capture_output=True)

Automation Scripts

bash
#!/bin/bash
# sync-script.sh
REMOTE="s3-remote"
LOCAL_DIR="/home/user/documents"
REMOTE_DIR="backup/documents"
# Sync local to remote
rclone sync "$LOCAL_DIR" "$REMOTE:$REMOTE_DIR" \
--progress \
--transfers 4 \
--checkers 8 \
--log-file /var/log/rclone-sync.log

Systemd Service

ini

# /etc/systemd/system/rclone-sync.service
[Unit]
Description=RClone Sync Service
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/rclone sync /home/user/data remote:backup
User=user
Group=user
[Install]
WantedBy=multi-user.target

Cron Integration

bash
# Add to crontab
0 2 * * * /usr/bin/rclone sync /home/user/data remote:backup --log-file /var/log/rclone.l