ISPConfig 3 - back-res a Backup and Restore script

Discussion in 'Plugins/Modules/Addons' started by go0ogl3, Dec 6, 2009.

  1. Vrij Media

    Vrij Media New Member

    Today I was in need of restoring 1 particular website. Unfortunately because back-res can't handle that I had to restore /var to a temp dir (which takes long time).

    While waiting on the backup to extract I scripted the modifications needed to:
    - Removed /var from DIRECTORIES
    - Added code to add all subdirectories of /var excluding /var/www and /var/vmail
    - Added code to add /var/www excluding subdirectories of /var/www/clients, all subdirectories of /var/www/clients and all subdirectories of /var/vmail

    Script is ready and I am testing now. Would go0ogl3 be interested in a proper diff against 0.9.4?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    When you have a improved version of the script, then it would be nice if you post it here in the thread.
     
  3. Vrij Media

    Vrij Media New Member

    Unfortunately it doesn't work as intended yet. I will post a new script as soon as I have tested extensively.
     
  4. Vrij Media

    Vrij Media New Member

    In the zipfile attached you will find 2 files:
    - a patch against the unmodified 0.9.4 version
    - a new version of the script which I have numbered 0.9.5, It would be nice if go0ogl3 would put this on his website so that we dont have cluttered versions.

    Please use at your own risk and have fun with it.
     

    Attached Files:

  5. shibble

    shibble New Member


    Same problem here, except:
    mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES

    it stops after the warning =x


    anybody who can help me out?
     
  6. Vrij Media

    Vrij Media New Member

    Attached a new version which addresses this issue.

    # -----------------------------------------------------------------------------
    # version 0.9.6 - 2014-02-04 (by Yavuz Aydin - Vrij Media)
    # --------------------------
    # - Changed mysql import routine to create database if it doesn't exist
    # - Changed code to import database
     

    Attached Files:

  7. robin99

    robin99 New Member

    When trying to perform a restore with the original script at http://www.eurosistems.ro/back-res

    I get the following error:

    Code:
        You want to restore dir all to date 2014-02-13.
    
    Please input "yes" if the above is ok with you and press [ENTER]: yes
    
    Extracting all dir's backup from date 2014-02-13 to /:
    touch: cannot touch `/tmp/tmpbck/datestart': No such file or directory
    touch: cannot touch `/tmp/tmpbck/dateend': No such file or directory
    find: `/tmp/tmpbck/datestart': No such file or directory
    find: `/tmp/tmpbck/datestart': No such file or directory
    find: `/tmp/tmpbck/dateend': No such file or directory
    
    
    ---------------------=== The back-res script by go0ogl3 ===---------------------
    
    
    Any ideas?

    It seems it is not picking up the first possible restore date that it can use?
     
  8. robin99

    robin99 New Member

    OK fixed it, as it was on a new machine it didn't have the /tmp/tmpbck folder

    had to:

    mkdir /tmp/tmpbck

    Currently restoring.
     
  9. go0ogl3

    go0ogl3 Member

    Updated to latest version 0.9.6

    Hello,

    I've updated the link to the latest version 0.9.6 - 2014-02-04 (thanks Yavuz Aydin - Vrij Media)
    The script is available at:

    http://www.eurosistems.ro/back-res

    old versions:

    http://www.eurosistems.ro/back-res.0.9.1
    http://www.eurosistems.ro/back-res.0.9.2
    http://www.eurosistems.ro/back-res.0.9.3
    http://www.eurosistems.ro/back-res.0.9.4
    http://www.eurosistems.ro/back-res.0.9.5.zip
    http://www.eurosistems.ro/back-res.0.9.6.zip

    P.S.:
    I'm using a version of this script to backup firebird databases also, it's mostly hard-coded but if it's usefull to somebody I'll try to make myself some time to adjust the code to make the restore also and to explain how it is working to backup.
     
  10. clttech

    clttech New Member

    restore error for mysql

    When I tried to restore a db I get the following error
    mysql: unknown option '-x'

    I used this command backupres db mydata 2014-03-22 /

    Any ideas?

    I was able to restore the database by extracting that one database file and running the import command.

    mysql -u root -p mydatabase < mydata.sql
     
  11. Jorge QWASS

    Jorge QWASS New Member

    I have just got the same error trying to recover some databases. So I have downloaded the last back-res.sh version just to recover with that script and it worked.

    I you just want to fix the recovery part from the script without updating it with all new changes provided by Vrij, then update the code around line 547 with just a section of Vrij script (v.5.6):

    Code:
                
    for i in $arh ; do
      rdb=`echo $i | cut -d "-" -f2`
        mysql --user="$dbuser" --password="$dbpassword" --execute "CREATE DATABASE IF NOT EXISTS $rdb;"
        $BZIP2 -dc $BACKUPDIR/$YDATE-$MDATE/$i | $TAR -xvO | mysql --user="$dbuser" --password="$dbpassword" --da    tabase=$rdb
      done
    echo -en "All restore jobs done!\nDatabase $2 restored to date $3!\n"
    
    Add also this in variables section:

    Code:
    BZIP2=`which bzip2`                                     # name and location of bzip2
    
    And the back-res.sh witl start to import databases.

    I would like to thank you Vrij because I was having problems to fix that importing feature and he saved me. Thanks!
     
    Last edited: Apr 15, 2014
  12. greg.phillipson

    greg.phillipson New Member

    First time ISP Config 3, first time back up.

    Hi,

    Just to set the tone, I decided it was time to take the leap of faith and host my own websites, I tried a could of things before I settles on a Dell R200 and ISP3. Which ran for about 3 months before I decided I needed a backup. I bought a QNAP and I have set it to auto backup, however I still get the following, for all databases.

    c4wp.wp_usermeta
    note : Table does not support optimize, doing recreate + analyze instead

    I guess from the other posts this is normal???

    I also get

    mysqldump: Got error: 1044: Access denied for user 'root'@'localhost' to database 'information_schema' when using LOCK TABLES
    -- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
    mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES
    /bin/tar: /www: Cannot stat: No such file or directory
    /bin/tar: Exiting with failure status due to previous errors


    This is the bit I don't get is everything working okay?

    Cheers
    Greg
     
  13. greg.phillipson

    greg.phillipson New Member

    ???

    Hi,

    Can anyone help me out with these errors please? Or am I missing a trick and this is old hat now?

    Cheers
    Greg
     
  14. frprim

    frprim New Member

    Same error here. Hope someone has a solution for this one.
    Im using Ubuntu 12.04LTS
     
  15. go0ogl3

    go0ogl3 Member

    Answers

    - The back-res script is trying to optimize tables (like a defrag) but not all database tables suport this - the "error" is normal
    - The other mysqldump errors can be ignored too
    - The last error can be a problem if the directory /www exists. If you don't have /www please remove it from the script configuration section.

    - Maybe, please check the backup files to see for yourself. They are simple archives.
     
  16. sageman

    sageman New Member

    Domain Symlinks

    Hi,

    thank you for the script, it has been working flawlessly over the last few years.

    I have just switched to version 0.9.6 -mainly because it saves all web folders separately and it is much easier to restore files for one client only.

    One problem I see on my setup (ISPConfig 3 - Debian 7 Perfect Setup) :
    the script also archives symlinks in /var/www/ .

    So, for example, I see
    full_var_www_clients_client0_web1-2014-07-15.tar.bz2
    AND the corresponding domain.tld (which is the same project)
    full_var_www_domain.tld-2014-07-15.tar.bz2

    The second tar is only a few bytes, basically containing folders and the symlink entry : !domain.tld

    Is there a way to tell the script to ignore the symlinks?

    Or, even better would be, to save project files under the corresponding domain.tld tar...

    -Richard
     
  17. Vrij Media

    Vrij Media New Member

    Ignoring the symlinks is not a good idea. For instance, if you accidentally delete a website abc.com, how would you know which client and which web that is?

    It would look cleaner if all files for 1 website is in 1 tar file but it would need a lot of work to make that happen cleanly. I see no disadvantages with the current setup so may I ask you:

    Why?
     
  18. sageman

    sageman New Member

    True, except that symlinks can be recreated in ISPConfig. Plus I have additionally saved this sort of information off-server. But you are right, the saved symlink can be helpful.

    Well, initially I just thought it might be a bit tidier ;). But yes, I realize now that this would be quite a bit of work and in the end you would end up with a file structure that differs from the server file structure.

    Thank you for your thoughts, this has cleared thinks up for me.

    - Richard
     
  19. MasterNe0

    MasterNe0 New Member

    i am currently using this script in a cron tab and it seems to be working partly.

    The problem is it doesn't seem to backup anything but the log files.

    If I run the script manually, it will backup all the folders but if I leave it as a cron tab job, I see the log files being backed up but nothing else in the main backup directly.

    Any ideas why it not backing up anything unless I run it manually?
     
  20. MasterNe0

    MasterNe0 New Member

    I figured out the 2014-08 folder contains incremental backups.
     

Share This Page