create time/date/year dir for rsync to backup

Discussion in 'Installation/Configuration' started by chief, Aug 12, 2019.

  1. chief

    chief Member HowtoForge Supporter

    Hi,
    I had some nice person delete a users email contents before the weekend. (Thanks) it resolved back to a microsoft hosted server in the states.
    This has brought right up to eye level the need for rotating backups, maybe daily, weekly, and monthly.
    there was a script created by schlaal https://www.howtoforge.com/community/threads/tutorial-full-back-up-of-ispconfig3-data-files.73293/ which i had tried, this kinda worked. but also had corrupted exisiting emails for the users. they were recovereable in /var/vmail/corrupted
    so going forward, i want to export database, website, emails. to a dated compressed file and then i will automate offloading them to backup serer for storage.
    As the script didnt work as expected, i would like something that doesnt corrupt.
    I had thought of something like - this - but the tar command fall with error.

    #!/bin/bash
    foldername=$(date '+%T-%d-%b-%Y')
    mkdir -p /root/"$foldername"
    cd "$foldername"
    touch 'hello.txt'
    rsync -av --delete /root/dir1/ /root/"$foldername"
    tar -zcvf $foldername.tar.gz $foldername

    dave
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What I do is install automysqlbackup on hosts, that dumps daily, weekly and monthly all databases. Then I have a host running backuppc to backup every night all hosts, including the database dumps, /var/vmail and website contents.
     
  3. chief

    chief Member HowtoForge Supporter

    my systems is multiserver on debian 9
    are these from apt-get or downloaded?
     
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    They are downloaded with apt-get, which is easy to find out with
    Code:
    apt-cache show  automysqlbackup backuppc | more
     
    chief likes this.
  5. chief

    chief Member HowtoForge Supporter

    thanks taleman, to confirm.
    automysqlbackup to backup mysql databases, dumps to files for backup, runs on ispconfig server.
    backuppc backups /var/vmail /var/www/ to be installed on ispconfig server?
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Install automysqlbackup on every server where you have databases.
    Install backuppc on a separate host. You can install it on ISPconfig server, but then your backups are on the backed up host and maybe even on the same disk.
     

Share This Page