The time has come for bek″pinga again 🙂 Yesterday I realized, that I forgot to do any backups and all the files are real 2 machines. Give another option for keeping. Because the machine is a test doesn't need much plastic recovery system so I turned to my old script in which there is some primitive functionality. Generally is extremely ugly and lupsvat known functionality to say take care only 1 Archive separately that the code is fairly static with these repetitions. Затова реших да го пренапиша, като този път не го надрасквма за 10 minutes. В новата си версия вече се подържат 10 стари backup файла. Което си една добра цифра.

#!/bin/bash

#path to tar command
TAR="$(which tar) cvzf"

function backup {

#path to beckup folder
cd $1

#remove oldest archive
rm -r *.10.tgz
sleep 3 #time for removing

#move old archives, we will save 10 old files
for i in {9..1}
do
let "n=$i+1"
mv "www.$i.tgz" "www.$n.tgz"
mv "mysql.$i.tgz" "mysql.$n.tgz"
mv "cron.$i.tgz" "cron.$n.tgz"
done

#and move the newest : )
mv www.tgz www.1.tgz
mv mysql.tgz mysql.1.tgz
mv cron.tgz cron.1.tgz

#path to first folder
$TAR www.tgz /var/www/
sleep 2
#path to second folder
$TAR mysql.tgz /var/lib/mysql/
sleep 2
}

#call backup function with folder path arg
backup /media/backup1
sleep 2
backup /media/backup2

#E0F

В общи линии нещата са ясни. I have a 2 монтирани дяла за бекъп в /media и в тях се наливат новите архиви като преди това се преименуват старите. Структурата на имената е очевидна и при ls команда ориентира е интуитивен.

Enhanced by Zemanta

Today I talk about the woes around a single server with Suhosin patch and how Debian Sqeeze deal with it. Now we start a little distance. When you install php in the Debian packaging system (stable for others I can not say how yet) you must install and suhosin mod to it. I had problems with some MAH-frame system written in php and took the cardinal decision instead to do debug the system and back Report Developer to lose security patches and thus save myself the trouble. Overall I can boldly say that this was one of the most stupid decisions I ever taken. At first remove module php5-suhosin restart web server-a and oops post – patch-a is still loaded. After a short study find, that the package is compiled and trots directly in the code which means that no exclusion or removal unless recompile the code again without patch. Solve that will drapna and recompile to deb package. Done sooner said do your apt-get source php5 pulling me this source code, razpaketirva and etc.. Here my ideal idea to remove the source of the package to remove the patch and compile it back to the Debian package plus one two small optimizations in compilation. said done – eliminate unnecessary patch of debian/patches/suhosin.patch I removed him from playing in debian/patches/series. So far everything clearly and without problems. Then run to compile package debuild and as I expected I blew compilation because of missing headers. Naturally there will be any shortages – I am still with debian netinstall. Quick fix stupidity run again compilation, at one point only faint again, that with a strange error in Zend / zend_stream.h or .c not remember exactly (if I can deal later to check exactly which file and the line thundered). After some doubting what is happening and why the hell can rumble of the Zend core – where it ought to rumble for any reason and a little longer study find that this problem is relatively rare and not many signs of it. I suspect that one of the patches in the source was wrong but I have no nerves to check it. Hmmmmm weird super weird. Almost I decided to compile pure php but I decided to try mirrors dotdeb there to see what happens. There compilation died because of some strange addictions but spared the problems in the main body. Which in turn is understandable they did them 30-40 patches which were in stable package. After several long and unsuccessful attempts I got tired and turned off my vanilla package and compile it with almost debian-ski options with the idea to rewrite my current system and install new packages from the feeder can behave package installed from the repository (probably another differentiated not a reasonable solution). As I expected without any patches installation went smoothly. This is the outcome of my config.nice file:

#! /bin/sh
#
# Created by configure

CFLAGS='-g -O2 -fPIC -Wall -fsigned-char -fno-strict-aliasing   -gstabs' \
CXXFLAGS='-g -O2' \
'./configure' \
'--with-apxs2=/usr/bin/apxs2' \
'--prefix=/usr/local/php5' \
'--disable-cgi' \
'--with-config-file-path=/etc/php5/apache2' \
'--with-config-file-scan-dir=/etc/php5/apache2/conf.d' \
'--build=x86_64-linux-gnu' \
'--host=x86_64-linux-gnu' \
'--sysconfdir=/etc' \
'--localstatedir=/var' \
'--mandir=/usr/share/man' \
'--disable-debug' \
'--with-regex=php' \
'--disable-rpath' \
'--disable-static' \
'--with-pic' \
'--with-layout=GNU' \
'--with-pear=/usr/share/php' \
'--enable-calendar' \
'--enable-fileinfo' \
'--enable-hash' \
'--enable-json' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-sysvmsg' \
'--enable-bcmath' \
'--with-bz2' \
'--enable-ctype' \
'--without-gdbm' \
'--with-iconv' \
'--enable-exif' \
'--enable-ftp' \
'--enable-dbase' \
'--with-gettext' \
'--enable-mbstring' \
'--with-onig=/usr' \
'--with-pcre-regex' \
'--with-mysql=shared,mysqlnd' \
'--with-mysql-sock=/var/run/mysqld/mysqld.sock' \
'--with-mysqli=shared,mysqlnd' \
'--enable-pdo=shared' \
'--with-pdo-mysql=shared,mysqlnd' \
'--with-pdo-odbc=shared,unixODBC,/usr' \
'--with-pdo-pgsql=shared,/usr/bin/pg_config' \
'--with-pdo-sqlite=shared,/usr' \
'--with-pdo-dblib=shared,/usr' \
'--enable-phar' \
'--enable-shmop' \
'--enable-sockets' \
'--enable-dom' \
'--enable-wddx' \
'--enable-tokenizer' \
'--with-zlib' \
'--with-kerberos=/usr' \
'--with-openssl=/usr' \
'--enable-soap' \
'--enable-zip' \
'--with-mhash=yes' \
'--with-exec-dir=/usr/lib/php5/libexec' \
'--with-system-tzdata' \
'--without-mm' \
'--with-readline=/usr' \
'--without-sybase-ct' \
'--without-sqlite' \
'--without-sqlite3' \
'--without-mssql' \
'--enable-pcntl' \
'--enable-inline-optimization' \
"[email protected]"

This configuration is similar to that of compilation dotdeb. As the most important-is the prefix option where you will have files with php libraries. It and other times correct according to your system so that you don't feel the compilation changing of roads.

Enhanced by Zemanta