Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Plugins/Modules/Addons

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #81  
Old 17th November 2010, 22:50
acidflash acidflash is offline
Junior Member
 
Join Date: Nov 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
+ mysql -uxxx -pxxxx acidflash_blog -xvjp /.backup/webhost/2010-11/db-acidflash_blog-2010-11-17.tar.bz2
mysql: unknown option '-x'
+ 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..
Reply With Quote
Sponsored Links
  #82  
Old 5th December 2010, 10:52
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Smile

Quote:
Originally Posted by drewb0y View Post
Solved by deleting the backup directory that I manually created instead of just letting the script do it.




Solved: my password had some characters init that confused it I guess, it was 15 characters long with mixed Upper and lower case characters, numbers and 2 special characters, an @ and a $. Not sure which messed it up, but changing

Code:
dbpassword="mypassword"
to
Code:
dbpassword='mypassword'
(single quotes on either side instead of double) seems to have fixed that.

After that - just a few errors for the default script trying to back up non existent directories such as
Code:
/bin/tar: /lib64: Cannot stat: No such file or directory
Just a little more modifying and I think I am good to go.

For go0ogl3 :

What is your OS version? Just curious.. Thanks for the great work!

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.
Reply With Quote
  #83  
Old 5th December 2010, 10:57
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Default

Quote:
Originally Posted by clttech View Post
I have the scrip copied to the /etc folder. I have a cron job setup for the job to run.
40 3 * * * /etc/back-res.sh 1>/dev/null 2>/dev/null

It has not run. I logged in switched to su and ran ./backup_res.sh and I get Permission denied. What should the permissions be set at?
Hello,

Did you make it executable?
Code:
chmod +x /etc/back-res.sh
Did you edited the variables in the header of the script?
Reply With Quote
  #84  
Old 5th December 2010, 11:25
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Question Strange...

Quote:
Originally Posted by acidflash View Post
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
+ mysql -uxxx -pxxxx acidflash_blog -xvjp /.backup/webhost/2010-11/db-acidflash_blog-2010-11-17.tar.bz2
mysql: unknown option '-x'
+ 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..
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.
Reply With Quote
  #85  
Old 1st January 2011, 21:36
cyrus1977 cyrus1977 is offline
Junior Member
 
Join Date: Jan 2011
Posts: 11
Thanks: 6
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by go0ogl3 View Post
Hello!

ISPConfig 3 is a great piece of software. I want to contribute with a little script, maybe somebody will make a module and insert it in ISPConfig 3 if it's usefull.

I use ISPConfig 3 in production on a small little used server and I have created a backup and restore script.
I've tryied to make myself understood in the script. The script can be used to backup a full or partial linux system with a full mysql dump.
My script is using only one full backup a month, the rest are incremental backups. This uses less space and less ressources. There are some drawbacks, but I haven't find anything like this on the net, so I created this little script and I hope I will have more time to make it better later.
For now this script is in a "It works for me" state, but I think it can be used safely if the user takes his time and reads all the info in the script header.

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

Thank you for good free software!
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 ?
Reply With Quote
  #86  
Old 1st January 2011, 21:47
cyrus1977 cyrus1977 is offline
Junior Member
 
Join Date: Jan 2011
Posts: 11
Thanks: 6
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #87  
Old 13th January 2011, 22:20
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Default

Quote:
Originally Posted by cyrus1977 View Post
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 ?
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...
Reply With Quote
  #88  
Old 13th January 2011, 22:26
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Default

Quote:
Originally Posted by cyrus1977 View Post
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
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...
Reply With Quote
The Following User Says Thank You to go0ogl3 For This Useful Post:
cyrus1977 (13th January 2011)
  #89  
Old 13th January 2011, 22:52
cyrus1977 cyrus1977 is offline
Junior Member
 
Join Date: Jan 2011
Posts: 11
Thanks: 6
Thanked 0 Times in 0 Posts
Default

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!
Reply With Quote
  #90  
Old 30th January 2011, 12:54
smurf64 smurf64 is offline
Junior Member
 
Join Date: Jan 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default 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 by smurf64; 30th January 2011 at 22:15.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
freebsd 7, samba 3, domain controller alexdimarco Suggest HOWTO 6 5th November 2010 16:54
how to restore Ispconfig from backup db na0lb Installation/Configuration 4 24th September 2008 08:51
Restore backup ISPConfig leeeonardo General 4 18th April 2007 20:21
Restore ispconfig complete backup statiic General 1 15th January 2007 10:32
Backup restore on ispconfig misterm Installation/Configuration 0 18th December 2005 23:32


All times are GMT +2. The time now is 12:42.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.