Abstract: Cloud-Based Backup of MacOS Platform Using 'rclone' command in bash.

This project outlines the process of creating a comprehensive backup of a Bitnami Drupal site hosted on an AWS Lightsail instance from a MacOS device. The procedure includes exporting the MySQL database, compressing Drupal site files, and transferring the backup to cloud storage services like Google Drive, iCloud, or OneDrive using SFTP or other MacOS-compatible methods. Step-by-step instructions are provided for stopping the server, performing the backup via command-line, and leveraging cloud integration options available on MacOS for safe, remote storage.



Here’s how you can interact with these services for backups of your local MacOS using bash command-line prompts.

1. Google Drive

  • rclone: A powerful command-line tool that allows you to sync and manage files on Google Drive, as well as many other cloud storage services, using SFTP-like commands.
    • Install rclone on your Mac:

      brew install rclone

    • Set up rclone with Google Drive:

      rclone config

      Follow the prompts to add a new remote for Google Drive.

    • Sync or copy files to Google Drive:

      rclone copy /path/to/local/files remote:folder_on_drive

2. iCloud

  • iCloud doesn’t support SFTP, but you can access iCloud Drive directly from your Mac’s Finder as it integrates into the file system. To programmatically back up files to iCloud, you can create a script that copies files to the iCloud Drive folder.
    • Example command to copy a file to iCloud Drive:

      cp /path/to/local/file ~/Library/Mobile\ Documents/com~apple~CloudDocs/Backups/

3. OneDrive

  • rclone also supports OneDrive. You can set up and manage your OneDrive backups just like with Google Drive.
    • Set up rclone with OneDrive:

      rclone config

      Choose “OneDrive” as the remote type and follow the prompts.

    • Sync or copy files to OneDrive:

      rclone copy /path/to/local/files remote:folder_on_onedrive

4. Automate Backups Using Cron Jobs

Once you have rclone or another method set up, you can automate backups to Google Drive, OneDrive, or iCloud by scheduling regular backups with cron jobs.

For example: bash crontab -e

Add a line like this to run a backup every day at 2 AM: bash 0 2 * * * rclone copy /path/to/local/files remote:folder_on_drive

While you can’t connect directly to these services using SFTP, rclone is a great alternative for managing cloud storage backups from the command line. 

Please let us know if you'd like help setting up any of these services. 

Sub-Domain
Confidentiality
No