View Single Post
  #108  
Old 18th April 2011, 11:20
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Exclamation Dirty fixes

Hello,

a quick fix for the tmpdir is to change the line:
Code:
mkdir $tmpdir
in
Code:
mkdir -p $tmpdir
If the database names contains the "-" or the "_" characters is another thing wich can cause problems. If the date from the filename for the databases is not in form 2011-04-17 there is another point of failure.

But still the error from the 448 line is because $RD it's not an integer. RD should be the first backup date calculated in epoch,
Code:
date --date "$resdate" +%s
So if all of the date parts are ok (previous commands you run), why RD is not? Maybe $redate is not what it should be... And $resdate
is obtained from those lines:
Code:
year=`ls -ctF $BACKUPDIR | grep -v ^log/ | tail -n 1 | cut -d "-" -f 2`
md=`ls -ctF $BACKUPDIR | grep -v ^log/ | tail -n 1 | cut -d "-" -f 3`
day=`ls -ctF $BACKUPDIR | grep -v ^log/ | tail -n 1 | cut -d "-" -f 4 | cut -d "." -f 1`
resdate=$year$md$day
So the problem it's because something strage happens when we extract the date parts from existing files.
I will list here the "debug procedure", hope we'll be able to solve this issue now:
- We can start with the $BACKUPDIR which is composed from the /etc/hostname file.
- If that is correct we can move to the next step,
Code:
ls -ctF $BACKUPDIR
command which you can run in the comand line, like
Code:
ls -ctF /bck/your_hostname
where your_hostname is the one from the /etc/hostname
- If that list seems like:
Code:
2011-04/                     full_var-2011-04-15.tar.bz2  full_sbin-2011-04-15.tar.bz2   full_lib64-2011-04-15.tar.bz2  full_home-2011-04-15.tar.bz2  full_boot-2011-04-15.tar.bz2  log/
full_www-2011-04-15.tar.bz2  full_usr-2011-04-15.tar.bz2  full_root.-2011-04-15.tar.bz2  full_lib-2011-04-15.tar.bz2    full_etc-2011-04-15.tar.bz2   full_bin-2011-04-15.tar.bz2
we can move to the next step:
- the first pipe
Code:
ls -ctF /bck/your_hostname | grep -v ^log/
the result should be like
Code:
2011-04/
full_www-2011-04-15.tar.bz2
full_var-2011-04-15.tar.bz2
full_usr-2011-04-15.tar.bz2
full_sbin-2011-04-15.tar.bz2
full_root.-2011-04-15.tar.bz2
full_lib64-2011-04-15.tar.bz2
full_lib-2011-04-15.tar.bz2
full_home-2011-04-15.tar.bz2
full_etc-2011-04-15.tar.bz2
full_boot-2011-04-15.tar.bz2
full_bin-2011-04-15.tar.bz2
- then we add the next pipe
Code:
ls -ctF /bck/your_hostname  | grep -v ^log/ | tail -n 1
and the result should be the first file, like:
Code:
full_bin-2011-04-15.tar.bz2
- we then proceed to the last pipe,
Code:
ls -ctF /bck/your_hostname  | grep -v ^log/ | tail -n 1 | cut -d "-" -f 2
which should give us the year like
Code:
2011
Hope you can follow those and post where the output is different so we can see where the problem is.

Quote:
Originally Posted by clttech View Post
I changed the sticky bit this morning
drwxrwxrwt 5 root root 4096 2011-04-17 08:01
still get the error

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

When I tried to do the ./backup-res db all 2011-04-01
I get this
date: invalid date `11/'
./backup-res: line 448: [: : integer expression expected
this is line 448
if [ "$RD" -gt "$ID" ] ; then

I am not sure what the `11 is all about
I will post on some of the other sites about the making and deleting of the /tmp/tmpbck and see what I can find

Here is the line in my backup-res
mysql -u$dbuser -p$dbpassword $rdb < $TAR -xvjp $BACKUPDIR/$YDATE-$MDATE/$i

here is the only part of the script I made changes to and I do have the latest

###############################
### Begin variables section ###
###############################

# Change the variables below to fit your computer/backup

COMPUTER=`cat /etc/hostname | awk 'NR==1{print $1}'` # name of this computer
DIRECTORIES="/var/lib/mysql /var/www
/var/vmail /etc" # directories to backup
EXCLUDED="/bck /tmp /dev /proc /sys /srv /media
/var/adm /var/cache /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" # exclude those dir's and files
BACKUPDIR="/bck/$COMPUTER" # where to store the backups
dbuser="root" # database user
dbpassword="xxxxxxxxxxxx" # database password
email="myemail@my.com" # mail for the responsible person
TAR=`which tar` # name and location of tar
ARG="-cjpSPf" #sparse # tar arguments P = removed /.
EARG="-xjpf" # tar extract arguments P = removed /
tmpdir="/tmp/tmpbck" # temp dir for database dump and other stuff
del_en="yes" # Enable delete of files if used space percent > than $maxp (yes or anything else)
maxp="85" # Max percent of used space before start of delete
hm="2359" # last minute of the day = last minute of the restored backup of the day restored

###################################
### End user editable variables ###
###################################

as for the "-" in the file names, in /var/lib/mysql there are not dir or files with that in it they all have "_". In the /var/www folder there are folders with that "-" in it, but those files restored. in the /var/www there are php-cgi-scripts and php-fcgi-scripts that I gues were made by ISPconfig 3 install...

Thanks again for your help...is there anything else you can think of I can get that may help to solve the issue.
Reply With Quote