 	FSBACKUP - file system backup and synchronization utility.

     * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY WARRANTIES *

For english documentation type 'perldoc fsbackip.pl'

---------------------------------------------------------------------------

FSBACKUP -       . 
	          http://www.opennet.ru/dev/fsbackup/
			
     : Maxim Chirkov <mc@tyumen.ru>

---------------------------------------------------------------------------
:
    .
     .
     .
    .
     .
     .
     .
        .
     .
    .

---------------------------------------------------------------------------
:

     fsbackup        
      . 

           ,
  fsbackup, :
    - 	  (   100  
	     ),   
	(     IDE   );

    -	 (     
	    ); 

    -    ( PGP       
	 );
	
    -	 (       
	,    ), 

    -	       , 
	     .
	
    -       (    
	     )

    - 	  (      
	(tar),        
	  ).

    - 	         .
    
    -	      MySQL  PostgreSQL.

    fsbackup       ,    
  ,   .    ,
       
,         .

           ,  fsbackup
     (  regex) 
      .

		 
---------------------------------------------------------------------------
 :

	create_backup.sh
	          
	      crontab.

	install.pl
	           Perl .

	fsbackup.pl
                 .

	cfg_example
                    
	    . 

	cache/
	         . 
	           
	sys_backup/
	          sysbackup.sh. 

	modules/
	    Perl      fsbackup.pl.
	
	scripts/
	       .
       
	scripts/mysql_backup.sh
	scripts/pgsql_backup.sh
	             
	      PostgreSQL  MySQL. 
	      :
	    1.      ;
	    2.      +     /;
	    3.      +     , 
	         /;

	scripts/sysbackup.sh
	             
	     FreeBSD  Linux,  Linux  rpm -   
	         .

	scripts/sysrestore.sh
	         ,   
	       sysbackup.sh,  - .
	    
	scripts/fsrestore.sh
	          .

---------------------------------------------------------------------------
 :

    - 2    : 
	timesize -   (, , ,  ...)
	md5 -   .

    - 4  :
	backup -     (..   
		      ).
	full_backup -    ,   (..   
		  ).
	sync -  .
	hash -   ,      (
		      )

    - 3   :
    	local 	   -      .
	remote_ssh -        SSH
	remote_ftp -       FTP.

    - 8   (  regex)   
         (     ) :
    	    /dir[/file] -   /  .
	    !/dir[/file] -  ,     ( ,   ).
	    # - 
	    =~ -     ,    .    .
	    f~ -   .    .
	    d~ -   .    .
	    =! - ""     ,    .    .
	    f! - ""   .    .
	    d! - ""   .    .
	         

    -      PGP.

    -    . ,  = 7 - 6  
         ,  7      
       .

    -          
       FreeBSD  Linux.

    -           
         PostgreSQL  MySQL.   :
	     -      ;
	     -      +     ;
	     -      +     , 
		   ;


---------------------------------------------------------------------------
:

         ./install.pl
          --prefix ,
          /usr/local/fsbackup.
    
           
    cfg_example,    cfg_example . 
    ,    "create_backup.sh",  
              
    .
          crontab:
    18 4 * * * /usr/local/fsbackup/create_backup.sh| mail -s"`name -n` backup report" root
       SQL     
      ./scripts (mysql_backup.sh, pgsql_backup.sh, sysbackup.sh).

    :
	>su
	# ./install.pl 
	# cd /usr/local/fsbackup
	# vi cfg_example
	# mv cfg_example server_backup.conf
	# vi create_backup.sh
	# crontab -e
	# cd scripts
	# vi sysbackup.sh
	# vi pgsql_backup.sh
	# exit
	>
	
--------------------------------------------------------------------------
 :

         
cfg_example.

,           
,      . ,   
/home,      /usr/home,      
   ,    .

,        
 . ,      
:
    server_etc.conf -     /etc   
		         PGP ;
    server_local.conf -  /usr/local,    , 
		       .
    server_home.conf -    (/home  /usr/home)

,        
  ($cfg_remote_path, $cfg_local_path),    
   ,   .conf ,   
.

---------------------------------------------------------------------------
 :

          
  ,    fsbackup .
,       /mnt/full_backup,   
  :
    # cd /
    # tar xzf /mnt/full_backup/full_backup.tar.gz
    # sh /mnt/full_backup/full_backup.dir

         
  scripts/fsrestore.sh,     
      .

     ,     
,         
(    scripts/sysbackup.sh  create_backup.sh) 
 scripts/sysrestore.sh.   ,   
    FreeBSD  Linux.

    SQL  PostgreSQL  Mysql,  
: psql -d template1 -f sqlbackupfile  mysql < sqlbackupfile.

        :
    -    (  )
    -    .
    -     scripts/sysrestore.sh   
      .
    -     scripts/fsrestore.sh
    -  SQL    .


     (   -  
".ext"):
  --.tar.gz   -  
                        (_-YYYY.MM.DD.HH.MM.SS-_.tar.gz).
  -.del           
  -.hash        .
  -.list       .
  -.dir            .


---------------------------------------------------------------------------
 :


       $cfg_backup_style:
    backup -    .   
	          ,  
	        $cfg_increment_level, 
	             
	           . , 
	       $cfg_increment_level = 7 - 6     
	     ,   7       . 
	     0 -   ,  .  - 
	       (  )    
	       ,       
	      ,        .
	             
	       .
	     
    full_backup -    ,  .    
	             
	     ).      
	       , ,  crontab 
	           .  - 
	              
	         .  - 
	             .
	             
	           (, 
	          ).

    sync     -   (    ssh  local).
	       ,   full_backup  backup (    
	      -c   fsbackup.pl),   ,   
	        ,       
	             .
	         ( )
	      ,  web-,  
	            ..

    hash    -   ,      ( -h).
                     ,  
	        ,     
	             ..


 fsbackup.pl,       :
    fsbackup.pl [-n|-f|-h|-c] _
	-n -       .
	-f - full_backup -    ,  .
	-h - hash -   ,     .
	-c - clean -        
	      .

---------------------------------------------------------------------------
    :

         
 $cfg_type.  3  : local, remote_ssh 
 remote_ftp.

    - local -      .
	:
	$cfg_type="local";
	$cfg_local_path="/var/backup"; #   .

    - remote_ssh -     ,  
	      SSH.
	         ssh ,
	  - ssh .  remote_ssh   ,
	   .    
	       ,   
	.    :

	:   -         
	     fsbackup.pl.   - 
	      .
	     ssh-keygen,    
	     ( passphrase  
	). ,   ssh-copy-id user@remotehost,  
	user -    remotehost -   ,
	(  ,      ~/.ssh,   
	authorized_keys,     identity.pub   
	).      ~/.ssh/authorized_keys  
	     ( ) 
	from="localhost",  localhost -    
	(from="localhost" 1024 23 1343.....).

	:

	$cfg_type="remote_ssh";
	$cfg_remote_host="server.remote.ru"; #      .
	$cfg_remote_login="backup_login"; #      .
	$cfg_remote_path="/home/backup_login/backup"; #      ,   .
	    
    - remote_ftp -     ,  
	  ftp,       ftp .
	         , 
	        tcpwrapper  firewall,
	     ,     ,
	  chroot ftp.     ftp, 
	        CPU.

	:

	$cfg_type="remote_ftp";
	$cfg_remote_host="server.remote.ru"; #      .
	$cfg_remote_password="Test1234"; #     ftp.
	$cfg_remote_login="backup_login"; #      .
	$cfg_remote_path="/home/backup_login/backup"; #      ,   .
	$cfg_remote_ftp_mode=0; # Active (0)  Passive (1) .

---------------------------------------------------------------------------
 :

         PGP 
GnuPG: http://www.gnupg.org ()  PGP: http://www.pgpi.org

:
      -      .
      -     .

    PGP      
( pgp2.6, pgp5.0, gnupg):

       (  ):
pgp2.6> pgp -kg
pgp5.0> pgpk -g
gnupg> gpg --gen-key  #        
			  gpg --quick-random

      (  ):
pgp2.6> pgp -akx <UserID> <    >
pgp5.0> pgpk -ax <UserID> <    >
gnupg> gpg --export -a <UserID> > <    >

,     (  ):
pgp2.6>pgp -ka <     >
pgp5.0>pgpk -a <     >
gnupg>gpg --import <    >
#  pgupg    (gpg --gen-key     ):
gnupg>gpg --sign-key < >

    (  ):
pgp2.6>cat encrypted.tar.gz | pgp -f -z'' > .tar.gz
pgp5.0>cat encrypted.tar.gz | pgpv -f -z'' > .tar.gz
gnupg>cat encrypted.tar.gz | gpg --decrypt > .tar.gz

   (  ):
pgp2.6>cat input| pgp -ef userid > output
pgp5.0>cat input| pgpe -f userid > output
gnupg>cat input| gpg -e -r userid > output



---------------------------------------------------------------------------
:
Alex Sokoloff. <sokoloff@mail.ru>
	-      (verbose mode).
	-    (   
          ),     fsbackup.cron.
	-    fsfind.pl       
	    list    .  - 
	   .    .
	-    Interbase .
	
Oleg S. Gints <oleg@cec.amur.elektra.ru>:
	-       
	    .
	-    mysql_backup.sh (    
	    --all-databases)
	-        
	   .
	-         
	    .

  <phantom@highway.ru>,   <teq@highway.ru>:
	-        , 
	          .

Aleksey Kuznetsov <ahk@spb.edu>
	-     --all-databases  mysql_backup.sh

Pavel Stoliarov <admin@tzto.infopac.ru>
	-         
	  .
	-       .

Alexandr Zhukov <sacha@ic.vrn.ru>
	-        
	    .

Zherdev Anatoly <tolyar@mx.ru>
	-      $cfg_stopdir_prune,  
	    ,     .
	  
Priamikov Alexei <apriam@info.novsu.ac.ru>
	-    fsrestore.sh

Valeriy Zavolodko <vals@pa.ktts.kharkov.ua>
	-      $cfg_root_path   "/".
	