Skip to content

Instantly share code, notes, and snippets.

@z3nth10n
Last active January 29, 2020 21:44
Show Gist options
  • Save z3nth10n/31da46ffbb938fdfdbb4b3f9dc5b64df to your computer and use it in GitHub Desktop.
Save z3nth10n/31da46ffbb938fdfdbb4b3f9dc5b64df to your computer and use it in GitHub Desktop.

Revisions

  1. z3nth10n revised this gist Jan 29, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,3 @@
    Add this file to crontab using `crontab -e`. There is a online generator: https://crontab-generator.org/
    Add this file to crontab using `crontab -e`. There is a online generator: https://crontab-generator.org/

    Use Task Scheduler on Windows 10 to execute the script: https://active-directory-wp.com/docs/Usage/How_to_add_a_cron_job_on_Windows.html
  2. z3nth10n revised this gist Jan 29, 2020. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions backup.cmd
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    @echo off
    rmdir /S / Q <target-folder>
    pscp -P <port> -pw <password> -r <user>@<host>:<source-folder> <target-folder>

    :: Example:
    :: pscp -P 12345 -pw 1234 -r [email protected]:/var/ftp/backup-admin debian-mv-z3nth10n-net
  3. z3nth10n revised this gist Jan 29, 2020. 2 changed files with 4 additions and 1 deletion.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    Add this file to crontab using `crontab -e`. There is a online generator: https://crontab-generator.org/
    4 changes: 3 additions & 1 deletion gistfile1.txt → backup.sh
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@

    rm /var/ftp/backup-admin/backup.tar.gz
    rm /var/ftp/backup-admin/.bash_history
    rm -rf /var/ftp/backup-admin/logs
    tar czf /var/ftp/backup-admin/backup.tar.gz /var/www
    cp ~/.bash_history /var/ftp/backup-admin/.bash_history
    cp ~/.bash_history /var/ftp/backup-admin/bash_history
    cp -R /var/log/apache2 /var/ftp/backup-admin/logs
    mysqldump --defaults-extra-file="/var/crons/mysql/.database.cnf" -u administrador --all-databases > /var/ftp/backup-admin/all_databases.sql
  4. z3nth10n created this gist Jan 29, 2020.
    8 changes: 8 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/bin/bash
    # https://stackoverflow.com/questions/19904992/mysqldump-without-password-in-crontab

    rm /var/ftp/backup-admin/backup.tar.gz
    rm /var/ftp/backup-admin/.bash_history
    tar czf /var/ftp/backup-admin/backup.tar.gz /var/www
    cp ~/.bash_history /var/ftp/backup-admin/.bash_history
    mysqldump --defaults-extra-file="/var/crons/mysql/.database.cnf" -u administrador --all-databases > /var/ftp/backup-admin/all_databases.sql