Skip to content

Instantly share code, notes, and snippets.

@scsskid
Forked from sutlxwhx/README.md
Last active September 1, 2021 15:28

Revisions

  1. scsskid revised this gist Sep 1, 2021. No changes.
  2. @sutlxwhx sutlxwhx revised this gist Aug 24, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ For MySQL / MariaDB:
    ```shell
    cp -r /etc/mysql/ /backup/$now/mysql/
    ```
    ## Advanced usage
    ## Advanced Usage
    Everything above can be also used in a bash script for any package you want. Just create backup.sh with the following text:
    ```shell
    #!/usr/bin/env bash
  3. @sutlxwhx sutlxwhx revised this gist Aug 24, 2018. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ For MySQL / MariaDB:
    cp -r /etc/mysql/ /backup/$now/mysql/
    ```
    ## Advanced usage
    Everything above can be also used in a bash script for any package you want:
    Everything above can be also used in a bash script for any package you want. Just create backup.sh with the following text:
    ```shell
    #!/usr/bin/env bash
    now=$(date +"%Y-%m-%d_%H-%M-%S")
    @@ -45,4 +45,12 @@ mkdir /backup/$now/mysql/
    cp -r /etc/nginx/ /backup/$now/nginx/
    cp -r /etc/php/ /backup/$now/php/
    cp -r /etc/mysql/ /backup/$now/mysql/
    ```
    Make it executable:
    ```shell
    chmod +x backup.sh
    ```
    And run from the current directory:
    ```
    ./backup.sh
    ```
  4. @sutlxwhx sutlxwhx revised this gist Aug 24, 2018. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -32,4 +32,17 @@ cp -r /etc/php/ /backup/$now/php/
    For MySQL / MariaDB:
    ```shell
    cp -r /etc/mysql/ /backup/$now/mysql/
    ```
    ## Advanced usage
    Everything above can be also used in a bash script for any package you want:
    ```shell
    #!/usr/bin/env bash
    now=$(date +"%Y-%m-%d_%H-%M-%S")
    mkdir /backup/$now/nginx/
    mkdir /backup/$now/php/
    mkdir /backup/$now/php/
    mkdir /backup/$now/mysql/
    cp -r /etc/nginx/ /backup/$now/nginx/
    cp -r /etc/php/ /backup/$now/php/
    cp -r /etc/mysql/ /backup/$now/mysql/
    ```
  5. @sutlxwhx sutlxwhx revised this gist Aug 24, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ This is the LAMP / LEMP environment backup guide in case you want or need to try

    ## Basic usage

    As a first thing we will setup a variable that will store current date and time. We will use year-month-day_hours-minutes-seconds format:
    As a first thing we will setup a variable that will store current date and time. We will use *year-month-day_hours-minutes-seconds* format:
    ```shell
    now=$(date +"%Y-%m-%d_%H-%M-%S")
    ```
  6. @sutlxwhx sutlxwhx revised this gist Aug 24, 2018. No changes.
  7. @sutlxwhx sutlxwhx renamed this gist Aug 24, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  8. @sutlxwhx sutlxwhx created this gist Aug 24, 2018.
    35 changes: 35 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    ## Introduction

    This is the LAMP / LEMP environment backup guide in case you want or need to try my [highload LEMP installation](https://github.com/sutlxwhx/highload-lemp-installation).

    ## Basic usage

    As a first thing we will setup a variable that will store current date and time. We will use year-month-day_hours-minutes-seconds format:
    ```shell
    now=$(date +"%Y-%m-%d_%H-%M-%S")
    ```
    Then we need to create a folder where Nginx configuration files will be stored:
    ```shell
    mkdir /backup/$now/nginx/
    ```
    We will repeat previous step for your PHP installation:
    ```shell
    mkdir /backup/$now/php/
    ```
    If you already have MySQL or MariaDB installed do this step too:
    ```shell
    mkdir /backup/$now/mysql/
    ```
    This is the main backup process, just copy files from one folder to another.
    <br/> For Nginx:
    ```shell
    cp -r /etc/nginx/ /backup/$now/nginx/
    ```
    For PHP:
    ```shell
    cp -r /etc/php/ /backup/$now/php/
    ```
    For MySQL / MariaDB:
    ```shell
    cp -r /etc/mysql/ /backup/$now/mysql/
    ```