ISPConfig 3 - back-res a Backup and Restore script

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

  1. danjde

    danjde New Member

    Hi Friends!
    Running back-res, after db backup, obtain this warnings/errors:

    Code:
    /sbin/back-res: line 407: [: too arguments
    /bin/tar: /www: function "stat" failed: File or directory does not exist
    /bin/tar: Exit with failure status based on previous errors

    This is the part of the script concerned:

    Code:
    for i in `echo $DIRECTORIES` ; do
        XX=`echo $i | awk '{gsub("/", "_", $0); print}'`
        YX=`echo $i | awk '{print $1}'`
        fb=`ls $BACKUPDIR | grep ^full$XX-`
            if [ -z $fb ] ; then
                log "No full backup found for $YX. Full backup now!"
                echo > $tmpdir/full-backup$XX.lck
                $TAR $ARG $BACKUPDIR/full$XX-$FDATE.tar.bz2 $YX -X $tmpdir/excluded
                log "Backup of $YX done."
            fi
    

    the 407 line is this:

    Code:
    if [ -z $fb ] ; then
    Why is this happening? Do I have something wrong?

    Many many thanks!
    Davide
     
  2. Geekteq

    Geekteq New Member

    If you had read the thread a few back you'd find the same already discussed.
    Look here #233
     
  3. danjde

    danjde New Member

    Thanks Geekteq, I didn't see the previous post :confused:
    Now, with the changes, it works fine!
    Strange that the developer has not yet corrected the bug! I'll try to report it to him.
     
  4. danjde

    danjde New Member

    Hi Friends,
    after to have corrected the bug described above,
    today (at the first one month day backup time) just a few minutes after starting the "back-res" script the MySQL server hangs:

    Code:
    service mysql stop
    Code:
    service mysql start
    Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
    Code:
    systemctl status mysql.service
    ● mysql.service - LSB: Start and stop the mysql database server daemon
       Loaded: loaded (/etc/init.d/mysql)
       Active: failed (Result: exit-code) since lun 2018-01-01 15:49:30 CET; 10s ago
      Process: 18210 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
      Process: 18261 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
    
    gen 01 15:49:30 server /etc/init.d/mysql[19100]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
    gen 01 15:49:30 server mysql[18261]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
    gen 01 15:49:30 server systemd[1]: mysql.service: control process exited, code=exited status=1
    gen 01 15:49:30 server systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
    gen 01 15:49:30 server systemd[1]: Unit mysql.service entered failed state.
    Then reloading again the MySQL server, everything is broken down correctly.

    Has anyone of you encountered similar problems?

    Many thanks!

    Davide
     
  5. yodaofborg

    yodaofborg New Member

    Still a great script after all this time, the only problem I have with it is it does not exclude directories from /var with the latest update, even if specified. log, spool, run, are all added due to the script recursive adding them in the # Add /var excluding subdirectories /var/www and /var/vmail to DIRECTORIES section. (debian 9.4 with version="0.9.6 from 2014-02-04")

    Still, great way of keeping daily backups of my sites, I just hate to waste disk space on things I do not need backed up :)

    [edit]

    Just fixed this myself, the tar command in debian 9 needs the -X option set before telling it what to backup, or it will include the files it has been told to (expected behaviour for GNU tar, since forever?), so changing the lines (around line 407) from:
    Code:
    $TAR $ARG $BACKUPDIR/full$XX-$FDATE.tar.bz2 $YX -X $tmpdir/excluded
    ..
    $TAR $ARG $BACKUPDIR/full$XX-$FDATE.tar.bz2 $YX -X $tmpdir/excluded
    ..
    $TAR $NEWER $ARG $BACKUPDIR/$MDATE/i$XX-$FDATE.tar.bz2 $YX -X $tmpdir/excluded 
    To:
    Code:
    $TAR $ARG $BACKUPDIR/full$XX-$FDATE.tar.bz2 -X $tmpdir/excluded $YX
    ..
    $TAR $ARG $BACKUPDIR/full$XX-$FDATE.tar.bz2 -X $tmpdir/excluded $YX
    ..
    $TAR $NEWER $ARG $BACKUPDIR/$MDATE/i$XX-$FDATE.tar.bz2 -X $tmpdir/excluded $YX
    fixed the issue.
     
    Last edited: May 18, 2018
    30uke, Gruppo Pegaso and ahrasis like this.
  6. toyinal

    toyinal Member

    I'm unable to restore /var directory from a date 2018-08-29 Im using back-res version 0.9.6 The program will all show blank when restoring but no files are restored. Also restoring a specific /var/vmail/xxxxx.tld from a particular date does not work. I know there is a backup file .tar.bz2 for that date and for that specific account, i've checked. Full backup restore works. I know that specific date restore works before the update to version 0.9.6

    Thanks
     
  7. dejvic

    dejvic New Member

    please have you got anyone right script for backup and restore ispconfig3 ver. 3.0.5.4p5 to last version?
     
  8. 30uke

    30uke New Member

    Thanks for sharing this as it also fixes the same issue for me.

    I did run a backup task and I noticed the following output.

    Code:
    [email protected]:/# /opt/back-res/back-res
    [..]
    /opt/back-res/back-res: line 290: /tmp/tmpbck/maildata: No such file or directory
    [..]
    roundcube.session
    note     : Table does not support optimize, doing recreate + analyze instead
    [..]
    mysqldump: Got error: 1044: "Access denied for user 'root'@'localhost' to database 'information_schema'" when using LOCK TABLES
    mysqldump: Got error: 1142: "SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'accounts'" when using LOCK TABLES
    [..]
    /bin/tar: /www: Cannot stat: No such file or directory
    /bin/tar: Exiting with failure status due to previous errors
    [..]
    /bin/tar: /var/lib/php7.0-fpm/web2.sock: socket ignored
    [..]
    /bin/tar: /var/log/mail.info: file changed as we read it
    
    I am a little bit worried about the databases 'information_schema' and 'performance_schema'. The dump does not represent the current database. I am not sure if this would be a real problem as these are system databases and not the databases required/used by the websites and ISPconfig. Would it be an idea to leave these databases out of the backup?

    I don't know what to think about the 'tar cannot stat' error. I don't believe the "/www" is required. It did not exist in the root of my system. I just did create it manually and put a place holder file - just to satisfy tar.

    Overall it looks like that the script just works fine. At least I have a bunch of usable

    And I did notice this file:
    Code:
    [email protected]:/# cat /tmp/tmpbck/maildata
    2019-01-09 22:29:40 - back-res - Temp dir /tmp/tmpbck created
    [..]
    2019-01-09 22:39:02 - back-res - All backup jobs done. Exiting script!
    
    But I did not receive any e-mail. Couldn't find an error in the script itself. I am able to send e-mails manually by reproducing the command from the script myself.
     

Share This Page