ISPConfig 3 - back-res a Backup and Restore script

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

  1. acidflash

    acidflash New Member

    Hi,

    I have a big problem with version="0.9.4 from 2010-09-13".

    When i try to restore with dir all 2010-11-17 /tmp/ all thing works out. But when i try to restore just one think with dir www 2010-11-17 /tmp

    Code:
    [root@webhost .backup]# ./backup dir www 2010-11-16 /tmp
    + version='0.9.4 from 2010-09-13'
    ++ cat /etc/hostname
    ++ awk 'NR==1{print $1}'
    + COMPUTER=webhost
    + DIRECTORIES='/bin /boot /etc /home /lib /lib64 /root.
    /sbin /usr /var /www'
    + EXCLUDED='/bck /tmp /dev /proc /sys /srv /media
    /var/adm /var/cache /var/lib/mysql
    /var/run /var/lock /lib/init/rw /var/tmp
    /var/log/verlihub /var/lib/amavis /var/amavis /var/spool/postfix/p*
    /var/spool/postfix/var *.pid *.lock *.lck'
    + BACKUPDIR=/.backup/webhost
    + dbuser=xxxx
    + dbpassword=xxxx
    + email=xxxx
    ++ which tar
    + TAR=/bin/tar
    + ARG=-cjpSPf
    + EARG=-xjpf
    + tmpdir=/tmp
    + del_en=yes
    + maxp=85
    + hm=2359
    ++ basename ./backup
    + me=backup
    + headline='
    ---------------------=== The back-res script by go0ogl3 ===---------------------
    '
    + usage='
    ---------------------=== The back-res script by go0ogl3 ===---------------------
    
    The backup part requires some configuration in the header of the script
    and it'\''s supposed to be run from cron. 
    The restore part it'\''s supposed to be run from command line.
    restore part Usage:
    \t backup [type-of-restore] [dir|db] [YYYY-MM-DD] [path]
    
    \t backup dir [dir-to-restore] [to-date] [path]
    \t backup dir all [to-date] [path]
    \t backup db [db-to-restore] [to-date]
    \t backup db all [to-date]
    
    Where '\''dir'\'' or '\''db'\'' to restore is one of the configured dirs or db'\''s to 
    backup, or '\''all'\'' to restore all dirs or db'\''s.
    Date format is full date, year sorted, YYYY-MM-DD, like 2009-01-30.
    '\''path'\'' is for dirs and is the path on which you want to extract the backup.
    If the path to extract is not set, then the backup is extracted on /.
    For more info read the header of this script!
    -===--===--===--===--===--===--===--===--===--===--===--===--===--===--===--===-
    '
    + case "$1" in
    + restore dir www 2010-11-16 /tmp
    + '[' -z /tmp ']'
    + path=/tmp
    + RDATE=2010-11-16
    ++ echo 2010-11-16
    ++ cut -d - -f3
    + DOM=16
    ++ echo 2010-11-16
    ++ cut -d - -f2
    + MDATE=11
    ++ echo 2010-11-16
    ++ cut -d - -f1
    + YDATE=2010
    + type=dir
    ++ echo www
    ++ awk '{gsub("/", "_", $0); print}'
    + dir=www
    + '[' -z 2010-11-16 ']'
    ++ ls -ctF /.backup/webhost
    ++ grep -v '^log/'
    ++ tail -n 1
    ++ cut -d - -f 2
    + year=2010
    ++ ls -ctF /.backup/webhost
    ++ grep -v '^log/'
    ++ tail -n 1
    ++ cut -d - -f 3
    + md=11
    ++ ls -ctF /.backup/webhost
    ++ grep -v '^log/'
    ++ tail -n 1
    ++ cut -d - -f 4
    ++ cut -d . -f 1
    + day=05
    + resdate=20101105
    + dh=1234
    ++ touch -t 201011161234 /tmp/datestart
    + err=
    + '[' 10 '!=' 10 ']'
    + '[' -n '' ']'
    ++ date +%s
    + TD=1290028343
    ++ date --date 2010-11-16 +%s
    + ID=1289858400
    ++ date --date 20101105 +%s
    + RD=1288908000
    + '[' 1289858400 -ge 1290028343 ']'
    + '[' 1288908000 -gt 1289858400 ']'
    + '[' dir = dir ']'
    + '[' -d /tmp ']'
    + '[' -n /tmp ']'
    + mesaj=
    + echo -en '\n    You want to restore dir www to date 2010-11-16.\n\nPlease input "yes" if the above is ok with you and press [ENTER]: '
    
        You want to restore dir www to date 2010-11-16.
    
    Please input "yes" if the above is ok with you and press [ENTER]: + read ok
    
    Please input "yes" if the above is ok with you and press [ENTER]: + read ok
    yes
    + [[ yes = \y\e\s ]]
    + [[ dir == \d\i\r ]]
    + [[ www == \a\l\l ]]
    + [[ /bin /boot /etc /home /lib /lib64 /root.
    /sbin /usr /var /www all =~ www ]]
    + echo -en '\nTrying to restore www dir'\''s backup from date 2010-11-16 to /tmp:\n\n'
    
    Trying to restore www dir's backup from date 2010-11-16 to /tmp:
    
    + sleep 5
    + dst=010000
    + touch -t 201011010000 /tmp/datestart
    + touch -t 201011162359 /tmp/dateend
    + '[' dir = dir ']'
    + [[ /bin /boot /etc /home /lib /lib64 /root.
    /sbin /usr /var /www all =~ www ]]
    + '[' www = all ']'
    ++ find /.backup/webhost -maxdepth 1 -type f -newer /tmp/datestart -a '!' -newer /tmp/dateend
    ++ sed 's_.*/__'
    ++ grep www
    ++ grep '^full_'
    + farh=full_www-2010-11-05.tar.bz2
    ++ find /.backup/webhost/2010-11 -maxdepth 1 -type f -newer /tmp/datestart -a '!' -newer /tmp/dateend
    ++ sed 's_.*/__'
    ++ grep -v '^db-'
    ++ grep www
    + arh='i_www-2010-11-09.tar.bz2
    i_www-2010-11-15.tar.bz2
    i_www-2010-11-12.tar.bz2
    i_www-2010-11-06.tar.bz2
    i_www-2010-11-16.tar.bz2
    i_www-2010-11-14.tar.bz2
    i_www-2010-11-10.tar.bz2
    i_www-2010-11-08.tar.bz2
    i_www-2010-11-11.tar.bz2
    i_www-2010-11-13.tar.bz2
    i_www-2010-11-07.tar.bz2'
    + for f in '$farh'
    + echo -en '\tExtracting full_www-2010-11-05.tar.bz2...\n\n'
    	Extracting full_www-2010-11-05.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/full_www-2010-11-05.tar.bz2 -C /tmp
    + '[' 16 = 01 ']'
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-09.tar.bz2...\n\n'
    	Extracting i_www-2010-11-09.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-09.tar.bz2 -C /tmp
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-15.tar.bz2...\n\n'
    	Extracting i_www-2010-11-15.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-15.tar.bz2 -C /tmp
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-12.tar.bz2...\n\n'
    	Extracting i_www-2010-11-12.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-12.tar.bz2 -C /tmp
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-06.tar.bz2...\n\n'
    	Extracting i_www-2010-11-06.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-06.tar.bz2 -C /tmp
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-16.tar.bz2...\n\n'
    	Extracting i_www-2010-11-16.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-16.tar.bz2 -C /tmp
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-14.tar.bz2...\n\n'
    	Extracting i_www-2010-11-14.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-14.tar.bz2 -C /tmp
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-10.tar.bz2...\n\n'
    	Extracting i_www-2010-11-10.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-10.tar.bz2 -C /tmp
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-08.tar.bz2...\n\n'
    	Extracting i_www-2010-11-08.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-08.tar.bz2 -C /tmp
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-11.tar.bz2...\n\n'
    	Extracting i_www-2010-11-11.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-11.tar.bz2 -C /tmp
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-13.tar.bz2...\n\n'
    	Extracting i_www-2010-11-13.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-13.tar.bz2 -C /tmp
    + for i in '$arh'
    + echo -en '\tExtracting i_www-2010-11-07.tar.bz2...\n\n'
    	Extracting i_www-2010-11-07.tar.bz2...
    
    + /bin/tar -xjpf /.backup/webhost/2010-11/i_www-2010-11-07.tar.bz2 -C /tmp
    + del_res /tmp www 2010-11-16 /tmp
    ++ find /tmp/www -newer /tmp/dateend
    find: /tmp/www: No such file or directory
    + to_rem=
    + echo -en '\n
    ---------------------=== The back-res script by go0ogl3 ===---------------------
    \n    For a clean backup restored at 2010-11-16 we need now to delete the files\ncreated after the backup date.\n    If exists, a list of files to be deleted follows:\n\n'
    
    
    ---------------------=== The back-res script by go0ogl3 ===---------------------
    
        For a clean backup restored at 2010-11-16 we need now to delete the files
    created after the backup date.
        If exists, a list of files to be deleted follows:
    
    + echo -en '\nPlease input "yes" to delete those files, if they exist, and press [ENTER]: '
    
    Please input "yes" to delete those files, if they exist, and press [ENTER]: + read del
    
    yes
    + [[ yes = \y\e\s ]]
    + echo -en 'All restore jobs done!\nDir www restored to date 2010-11-16!\n'
    All restore jobs done!
    Dir www restored to date 2010-11-16!
    + exit
    
    And when i check in /tmp nothing in /tmp/www.

    I also have problem with restoring DB:s with the script

    Code:
    [root@webhost .backup]# ./backup db acidflash_blog 2010-11-17
    + version='0.9.4 from 2010-09-13'
    ++ awk 'NR==1{print $1}'
    ++ cat /etc/hostname
    + COMPUTER=webhost
    + DIRECTORIES='/bin /boot /etc /home /lib /lib64 /root.
    /sbin /usr /var /www'
    + EXCLUDED='/bck /tmp /dev /proc /sys /srv /media
    /var/adm /var/cache /var/lib/mysql
    /var/run /var/lock /lib/init/rw /var/tmp
    /var/log/verlihub /var/lib/amavis /var/amavis /var/spool/postfix/p*
    /var/spool/postfix/var *.pid *.lock *.lck'
    + BACKUPDIR=/.backup/webhost
    + dbuser=xxx
    + dbpassword=xxx
    + email=xxx
    ++ which tar
    + TAR=/bin/tar
    + ARG=-cjpSPf
    + EARG=-xjpf
    + tmpdir=/tmp
    + del_en=yes
    + maxp=85
    + hm=2359
    ++ basename ./backup
    + me=backup
    + headline='
    ---------------------=== The back-res script by go0ogl3 ===---------------------
    '
    + usage='
    ---------------------=== The back-res script by go0ogl3 ===---------------------
    
    The backup part requires some configuration in the header of the script
    and it'\''s supposed to be run from cron. 
    The restore part it'\''s supposed to be run from command line.
    restore part Usage:
    \t backup [type-of-restore] [dir|db] [YYYY-MM-DD] [path]
    
    \t backup dir [dir-to-restore] [to-date] [path]
    \t backup dir all [to-date] [path]
    \t backup db [db-to-restore] [to-date]
    \t backup db all [to-date]
    
    Where '\''dir'\'' or '\''db'\'' to restore is one of the configured dirs or db'\''s to 
    backup, or '\''all'\'' to restore all dirs or db'\''s.
    Date format is full date, year sorted, YYYY-MM-DD, like 2009-01-30.
    '\''path'\'' is for dirs and is the path on which you want to extract the backup.
    If the path to extract is not set, then the backup is extracted on /.
    For more info read the header of this script!
    -===--===--===--===--===--===--===--===--===--===--===--===--===--===--===--===-
    '
    + case "$1" in
    + restore db acidflash_blog 2010-11-17
    + '[' -z '' ']'
    + path=/
    + RDATE=2010-11-17
    ++ echo 2010-11-17
    ++ cut -d - -f3
    + DOM=17
    ++ echo 2010-11-17
    ++ cut -d - -f2
    + MDATE=11
    ++ echo 2010-11-17
    ++ cut -d - -f1
    + YDATE=2010
    + type=db
    ++ echo acidflash_blog
    ++ awk '{gsub("/", "_", $0); print}'
    + dir=acidflash_blog
    + '[' -z 2010-11-17 ']'
    ++ ls -ctF /.backup/webhost
    ++ grep -v '^log/'
    ++ tail -n 1
    ++ cut -d - -f 2
    + year=2010
    ++ ls -ctF /.backup/webhost
    ++ grep -v '^log/'
    ++ tail -n 1
    ++ cut -d - -f 3
    + md=11
    ++ ls -ctF /.backup/webhost
    ++ grep -v '^log/'
    ++ tail -n 1
    ++ cut -d - -f 4
    ++ cut -d . -f 1
    + day=05
    + resdate=20101105
    + dh=1234
    ++ touch -t 201011171234 /tmp/datestart
    + err=
    + '[' 10 '!=' 10 ']'
    + '[' -n '' ']'
    ++ date +%s
    + TD=1290028614
    ++ date --date 2010-11-17 +%s
    + ID=1289944800
    ++ date --date 20101105 +%s
    + RD=1288908000
    + '[' 1289944800 -ge 1290028614 ']'
    + '[' 1288908000 -gt 1289944800 ']'
    + '[' db = dir ']'
    + echo -en '\n    You want to restore db acidflash_blog to date 2010-11-17.\n\nPlease input "yes" if the above is ok with you and press [ENTER]: '
    
        You want to restore db acidflash_blog to date 2010-11-17.
    
    Please input "yes" if the above is ok with you and press [ENTER]: + read ok
    yes
    + [[ yes = \y\e\s ]]
    + [[ db == \d\i\r ]]
    + [[ db == \d\b ]]
    + [[ acidflash_blog == \a\l\l ]]
    + [[ '' =~ acidflash_blog ]]
    + dst=010000
    + touch -t 201011010000 /tmp/datestart
    + touch -t 201011172359 /tmp/dateend
    + '[' db = dir ']'
    + '[' db = db ']'
    + db=acidflash_blog
    ++ find /.backup/webhost/2010-11 -maxdepth 1 -type f
    ++ sed 's_.*/__'
    ++ grep '^db-'
    ++ grep 2010-11-17
    ++ cut -d - -f2
    + dblist='mysql
    c11
    c10tidningen
    fiskapa
    c0makila
    acidflash_blog
    c11new
    c91
    information_schema
    c0makila2
    c2wordpress
    dbispconfig
    c6brando
    joomla_jarnkamin'
    + dblist='mysql
    c11
    c10tidningen
    fiskapa
    c0makila
    acidflash_blog
    c11new
    c91
    information_schema
    c0makila2
    c2wordpress
    dbispconfig
    c6brando
    joomla_jarnkamin all'
    + for d in '$dblist'
    + '[' mysql == acidflash_blog ']'
    + for d in '$dblist'
    + '[' c11 == acidflash_blog ']'
    + for d in '$dblist'
    + '[' c10tidningen == acidflash_blog ']'
    + for d in '$dblist'
    + '[' fiskapa == acidflash_blog ']'
    + for d in '$dblist'
    + '[' c0makila == acidflash_blog ']'
    + for d in '$dblist'
    + '[' acidflash_blog == acidflash_blog ']'
    + '[' acidflash_blog = all ']'
    ++ find /.backup/webhost/2010-11 -maxdepth 1 -type f
    ++ sed 's_.*/__'
    ++ grep '^db-'
    ++ grep 2010-11-17
    ++ grep acidflash_blog-
    + arh=db-acidflash_blog-2010-11-17.tar.bz2
    + for i in '$arh'
    ++ echo db-acidflash_blog-2010-11-17.tar.bz2
    ++ cut -d - -f2
    + rdb=acidflash_blog
    [I]+ mysql -uxxx -pxxxx acidflash_blog -xvjp /.backup/webhost/2010-11/db-acidflash_blog-2010-11-17.tar.bz2
    mysql: unknown option '-x'[/I]
    + echo -en 'All restore jobs done!\nDatabase acidflash_blog restored to date 2010-11-17!\n'
    All restore jobs done!
    Database acidflash_blog restored to date 2010-11-17!
    + for d in '$dblist'
    + '[' c11new == acidflash_blog ']'
    + for d in '$dblist'
    + '[' c91 == acidflash_blog ']'
    + for d in '$dblist'
    + '[' information_schema == acidflash_blog ']'
    + for d in '$dblist'
    + '[' c0makila2 == acidflash_blog ']'
    + for d in '$dblist'
    + '[' c2wordpress == acidflash_blog ']'
    + for d in '$dblist'
    + '[' dbispconfig == acidflash_blog ']'
    + for d in '$dblist'
    + '[' c6brando == acidflash_blog ']'
    + for d in '$dblist'
    + '[' joomla_jarnkamin == acidflash_blog ']'
    + for d in '$dblist'
    + '[' all == acidflash_blog ']'
    + '[' -z acidflash_blog ']'
    + '[' -n '' ']'
    ++ date +%F
    + mail -s 'Daily backup of webhost 2010-11-17' xxx@xxx
    ./backup: line 574: /tmp/maildata: No such file or directory
    + rm -rf /tmp/datestart
    + rm -rf /tmp/dateend
    + rm -rf /tmp/excluded
    + rm -rf /tmp/maildata
    
    Can someone please tell me how to fix this so i can restore use this script..
     
  2. go0ogl3

    go0ogl3 Member


    Hello,

    The error about /lib64 is because the script is insctucted to backup that too.
    About the OS I use: mainly Slackware, Debian, Ubuntu, rarely CentOS, Free or OpenBSD and many others. The script is working on any of those :) after correct configuration.

    Thanks for solving and posting your issue here. Maybe will help others too.
     
  3. go0ogl3

    go0ogl3 Member

    Hello,

    Did you make it executable?
    Code:
    chmod +x /etc/back-res.sh
    Did you edited the variables in the header of the script?
     
  4. go0ogl3

    go0ogl3 Member

    Strange...

    Hello,

    I've had a very quick view and I seems that you don't have the tar executable, or which is finding wrong where tar is (/bin/tar) or you have another $TAR which is overriding the script variable. The "mysql: unknown option '-x'" error is because the $TAR variable is empty at that point.
    You also have a strange sort order for the restore of incremental arhives and the script should be restoring from the oldest to the newest ones, this may be because the modify time of the files is different from what it should be.

    To recover only the 'www' dir you can extract the full arhive and all necessary incremental ones by hand if the create/modify date of the backup are messed up somehow. Same for the databases.

    Verify the tar command and the create/modify time for the backups and post here so we can help you and others.
     
  5. cyrus1977

    cyrus1977 New Member

    Great script only thing i miss is to sync it over rsync to a remote backup machine instead of keeping the backup on the backupped machine... Or did i miss anything ?
     
  6. cyrus1977

    cyrus1977 New Member

    Warning: the directories lines contains an error:

    DIRECTORIES="/bin /boot /etc /home /lib /lib64 /root.
    /sbin /usr /var /www"

    should read

    DIRECTORIES="/bin /boot /etc /home /lib /lib64 /root
    /sbin /usr /var /www"

    attention: /root. has been changed to /root
     
  7. go0ogl3

    go0ogl3 Member

    Hello,

    you can mount a samba share from another machine or some ftp file system, or yo can scp all files over the net when the script has finished the backup, or you can use rsync for that :)

    P.S.: This work is done in my free time and sadly I don't have much...
     
  8. go0ogl3

    go0ogl3 Member

    Hello again!

    I think you use the latest mc with the latest settings and you just used some mouse copy and paste for the script... so you copied a "point" instead of a space. And here is the error...
     
  9. cyrus1977

    cyrus1977 New Member

    I know and i appreciate it much!. Am investigating the options to contribute something to the script.
    Will post it when i get it working!
     
  10. smurf64

    smurf64 New Member

    how restore?

    My output after run scrip is:

    Code:
    root@terserver:/home/badmin# ./back-res
    mysql.general_log
    note     : The storage engine for the table doesn't support optimize
    mysql.slow_log
    note     : The storage engine for the table doesn't support optimize
    /bin/tar: /var/log/syslog: file changed as we read it
    /bin/tar: /var/log/auth.log: file changed as we read it
    /bin/tar: /var/log/messages: file changed as we read it
    /bin/tar: /var/lib/apache2/fcgid/sock/32697.0: socket ignored
    root@terserver:/home/badmin#
    It is O.K.?
     
    Last edited: Jan 30, 2011
  11. go0ogl3

    go0ogl3 Member

    Short answer: Yes.
    The mysql you have it's using newer type of storage engine wich does not support optimize.
    The syslog daemon usually keeps writing :) if it's not stopped. Don't worry you will have the missing lines in the next daily backup if you need them. Same with apache.

    Don't forget to setup a cron job daily...
     
  12. clttech

    clttech New Member

    Restore Question

    I am new to Linux so I have a question about the backup-res restore. I created a dir /bck. This is where I have the backup-res put my backup files. It then creates a folder that is my domain name me.mydomain.tld. Inside that folder it creates the following
    2011-02
    2011-01
    log
    full_var_lib_mysql-2011-02-01.tar.bz2
    full_var_vmail-2011-02-01.tar.bz2
    full_etc-2011-02-01.tar.bz2
    full_var_www-2011-02-01.tar.bz2
    full_var_lib_mysql-2010-11-03.tar.bz2
    when I run the ./backup-res dir all 2011-02-01 / this is what I get
    -su: ./backup-res: No such file or directory
    What am I missing here. I have the backup-res in the /etc folder
    I am running Ununtu 10.04.01 LTS
     
  13. go0ogl3

    go0ogl3 Member


    If you have the script in /etc then it will only work when you'll run it from there. So you'll have to 'cd /etc' first or run '/etc/back-res ...........'
    Please read the info from the header of the script. I've tried to explain everything there. Then modify the variables as you like.
     
  14. Florisjan

    Florisjan New Member

    Restore backup on different server

    Hi

    I've managed to copy the backup files to a new server using scp. After processing all the sql dumps I untarred the /var/www and /var/vmail directories. However, the user names are obviously missing on the new server, so the owners of the files are now all set to root (except for a few files, of which the owner does exist.)

    Am I missing something, or if not, is there a way to solve this, for instance by copying the entire user 'database' from one server to the other?

    I feel I am very close to making a running backup server, but can't figure this out.

    Thanks a lot!
     
  15. go0ogl3

    go0ogl3 Member

    Restore the users, groups and permissions

    Hello, I'm sorry to respond so late, but if you've have the backup of /etc restore that first (so you can have the user and groups from the old server) then restore the rest. This way you can preserve de file owner and permissions.

    The other way is to instal the same linux version onto a new drive, then restore the backup on top of the new machine. So you can have a full working state of the backed up machine at your chosen date.

    Hope this helps others too.

     
  16. neutrino

    neutrino Member

    Hey folks,

    I'm saving my server for some month with this great script an now I need to backup a folder.


    What I launched as command was the following :

    Code:
    www:~/bin# ./backup.sh dir /var/www/clients/client0/web3/web 2011-04-01 /var/www/clients/client0/web3/web
    Then I obtained this :

    Code:
    You want to restore dir /var/www/clients/client0/web3/web to date 2011-04-01.
    
    Please input "yes" if the above is ok with you and press [ENTER]: yes
    touch: cannot touch `/tmp/tmpbck/datestart': No such file or directory
    touch: cannot touch `/tmp/tmpbck/dateend': No such file or directory
    
    ---------------------=== The back-res script by go0ogl3 ===---------------------
    
    The backup part requires some configuration in the header of the script
    and it's supposed to be run from cron.
    The restore part it's supposed to be run from command line.
    restore part Usage:
             backup.sh [type-of-restore] [dir|db] [YYYY-MM-DD] [path]
    
             backup.sh dir [dir-to-restore] [to-date] [path]
             backup.sh dir all [to-date] [path]
             backup.sh db [db-to-restore] [to-date]
             backup.sh db all [to-date]
    
    Where 'dir' or 'db' to restore is one of the configured dirs or db's to
    backup, or 'all' to restore all dirs or db's.
    Date format is full date, year sorted, YYYY-MM-DD, like 2009-01-30.
    'path' is for dirs and is the path on which you want to extract the backup.
    If the path to extract is not set, then the backup is extracted on /.
    For more info read the header of this script!
    -===--===--===--===--===--===--===--===--===--===--===--===--===--===--===--===-
    
                    ###     Invalid directory to restore!   ###
    
    ./backup.sh: line 574: /tmp/tmpbck/maildata: No such file or directory
    
    And line 574 contains this :

    Code:
    # Send accumulated maildata an cleanup
    mail -s "Daily backup of $COMPUTER `date +'%F'`" "$email" < $tmpdir/maildata
    
    So I think something is wrong with /tmp/tmpbck but since I do not know how this script exacly works I wanted to have some advice before trying some changes.

    The script is in /root/bin and the data is in /bck

    Thanks
     
    Last edited: Apr 3, 2011
  17. kostas1972

    kostas1972 New Member

    Hi...

    thanks for the script!

    any one know what that -> binary operator expected ... means?


    ================
    /etc/back-res: line 347: [: full_bin-2011-03-25.tar.bz2: binary operator expected
    /etc/back-res: line 347: [: full_boot-2011-03-25.tar.bz2: binary operator expected
    /etc/back-res: line 347: [: full_etc-2011-03-25.tar.bz2: binary operator expected
    /etc/back-res: line 347: [: full_home-2011-03-25.tar.bz2: binary operator expected
    =====================

    is this a kind of problem ?

    thanks!
     
  18. clttech

    clttech New Member

    Thanks for such a great script.

    I am having a very similar problem.

    You want to restore dir all to date 2011-04-01.

    Please input "yes" if the above is ok with you and press [ENTER]: yes

    Extracting all dir's backup from date 2011-04-01 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 ===---------------------

    For a clean backup restored at 2011-04-01 we need now to delete the files
    created after the backup date.
    If exists, a list of files to be deleted follows:


    Please input "yes" to delete those files, if they exist, and press [ENTER]:
    /bck/c3po.clttechnologies.com/./backup-res: line 572: /tmp/tmpbck/maildata: No such file or directory


    Line 572 is
    mail -s "Daily backup of $COMPUTER `date +'%F'`" "$email" < $tmpdir/maildata
     
  19. go0ogl3

    go0ogl3 Member

    Temp dir for the script...

    It seems that you don't have a /tmp directory, or the script does NOT have access to write to /tmp. The script is creating the /tmp/tmpbck dir and keeps there all the files it needs to run.
    Please check that you have the /tmp dir and if you do please check that is writable by the script (the user you run the script should be root).

    The place where the script is located is not so important...

    Hope this helps...

     
  20. go0ogl3

    go0ogl3 Member

    Strange error

    Hello!

    Do you have the latest version of the script? What is the 347 line of your script? What's the BACKUPDIR you set? It's empty?

    In the 347 line of the script, as I know it, is not a test in any version of the script and that error is only if you test something...
    If the 347 line is
    Code:
    if [ -z $fb ] ; then
    and you have the BACKUPDIR set,
    then please check if you have spaces in the backup path... or try to modify the line like:
    Code:
    if [ -z "$fb" ] ; then

     

Share This Page