Learn about Centmin Mod LEMP Stack today
Become a Member

Create a folder by date and then backup inside script.sh

Discussion in 'System Administration' started by pamamolf, Jul 7, 2014.

  1. pamamolf

    pamamolf Premium Member Premium Member

    3,267
    307
    83
    May 31, 2014
    Ratings:
    +566
    Local Time:
    6:32 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Hi

    How can i adjust this:
    Code:
    cd /home/nginx/domains/mydomain.com/
    tar -zcf /home/backup/backup_files_$(date +\%d-\%m-\%Y).tgz public 
    to auto create a folder inside /home/backup/07072014 every time that runs the script so the backup will go there and have a better view of backups?

    Thanks
     
  2. eva2000

    eva2000 Administrator Staff Member

    39,777
    8,774
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,505
    Local Time:
    1:32 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    just change your tar line for /home/backup/ to add the data stamped folder... but wouldn't that end up a mess ? once that month is over ? /home/backup/07072014/ would have included august, september and so on files

    eaiser to leave as is
     
    • Like Like x 1
..