Skip to content

Instantly share code, notes, and snippets.

@ajmaltridz
Last active October 23, 2023 13:00
Show Gist options
  • Save ajmaltridz/33b900293312609ac6a3f0708b1d194b to your computer and use it in GitHub Desktop.
Save ajmaltridz/33b900293312609ac6a3f0708b1d194b to your computer and use it in GitHub Desktop.
New Backup Script

Backup Script Instructions

This script is designed to help you take backups of specific folders. To specify the folders and their backup configurations, follow these instructions.

man page

<folder-name>;<nocode/nodb/skip>;<lando>

field1 = folder-name - name of the folder you want to back up
field2 = nocode/nodb/skip (optional), you can leave the field blank or just give "skip" for readability
field3 = lando (optional), only if its a lando project

Setup

  1. Create a .backup file: In your HOME directory, create a file named .backup. This file will contain a list of folders and their backup configurations.

Folder Configuration

  1. Specify the folders: List the names of the folders you want to back up, with each folder name on a separate line. For example:
folder1
folder2

This will back up "folder1" and "folder2" by default (both code and database).

  1. Customize backup configurations: You can customize the backup configurations for each folder by adding optional flags after the folder name.
  • To skip code backup for a folder, add ;nocode after the folder name. For example:

    folder1;nocode
    
  • To skip database backup for a folder, add ;nodb after the folder name. For example:

    folder1;nodb
    
  • For Lando projects, to take database backups, you can add ;lando after adding skip after folder name. For Example:

    folder1;skip;lando
    

    The lando flag is used to indicate that the project is a Lando project, the "skip" flag is used to avoid applying the "nocode" flag. This means that code backup is enabled for "folder1," and Lando database backup is also enabled.

  • To skip code backup and enable Lando database backup, use:

    folder1;nocode;lando
    

Examples

  • Backup "folder1" with code and enable Lando database backup:

  • Backup "folder2" without db(not a lando project):

    folder1;skip;lando
    folder2;nodb
    

    In this configuration, the "skip" flag is used to avoid applying the "nocode" flag. This means that code backup is enabled for "folder1," and Lando database backup is also enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment