]> wagner.pp.ru Git - sites/csbook.git/commitdiff
some new scripts
authorvsl <vsl>
Sat, 21 Dec 2002 01:29:16 +0000 (01:29 +0000)
committervsl <vsl>
Sat, 21 Dec 2002 01:29:16 +0000 (01:29 +0000)
chapters/backups.tex

index e63d6649cf59d387592fa4651a216af854e7b4d6..330c4cbd4dde141be5873b8128da6f0e3dc9e1d7 100644 (file)
@@ -54,7 +54,8 @@
 ÉÓÐÏÌØÚÕÅÔÓÑ ÆÁÊÌÏ×ÁÑ ÓÉÓÔÅÍÁ ext3 c --journal-data, É ÏÎ
 ÒÅÁÌÉÚÏ×ÁΠËÁË ÓÏÆÔÏ×ÙÊ RAID--ÍÁÓÓÉ× (mirror) ÉÚ Ä×ÕÈ ÏÄÉÎÁËÏ×ÙÈ ÖÅÓÔËÉÈ
 ÄÉÓËÏ×. ôÁË ÖÅ ÉÍÅÅÔÓÑ × ÎÁÌÉÞÉÉ ÕÓÔÒÏÊÓÔ×Ï ÚÁÐÉÓÉ CDRW--ÄÉÓËÏ× (ÎÏ ÎÅÔ
-ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÙ UDF). æÉÎÁÎÓÏ×ÙÅ ×ÏÚÍÏÖÎÏÓÔÉ ÎÁÛÅÇÏ ÐÏÌØÚÏ×ÁÔÅÌÑ
+ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÙ UDF, ÄÁÂÙ ÓÉÔÕÁÃÉÑ ÐÏÈÏÄÉÌÁ ÎÁ ÉÓÐÏÌØÚÏ×ÁÎÉÅ ÌÅÎÔÏÞÎÏÇÏ
+ÎÁËÏÐÉÔÅÌÑ). æÉÎÁÎÓÏ×ÙÅ ×ÏÚÍÏÖÎÏÓÔÉ ÎÁÛÅÇÏ ÐÏÌØÚÏ×ÁÔÅÌÑ
 ÏÇÒÁÎÉÞÅÎÎÙ, ÔÁË ÞÔÏ ÏΠÍÏÖÅÔ ÓÅÂÅ ÐÏÚ×ÏÌÉÔØ ×ÙÄÅÌÉÔØ ÐÏÄ ÒÅÚÅÒ×ÎÏÅ
 ËÏÐÉÒÏ×ÁÎÉÅ ÌÉÛØ 6 ÂÏÌ×ÁÎÏË. ðÒÏÍÁÒËÉÒÕÅÍ ÉÈ ÚÁÒÁÎÅÅ ËÁË ``Backup disk 1'',
 ``Backup disk 2'', ..., ``Backup disk 6''.
@@ -103,3 +104,77 @@ $SYNC work
 0 * * * *   /home/user/backup0.sh > /dev/null 2>&1
 \end{verbatim}
 
+ ôÅÐÅÒØ ÂÕÄÅÍ ÄÅÌÁÔØ ÎÁËÏÐÌÅÎÉÅ ÉÎËÒÅÍÅÎÔÁÌØÎÙÈ ÁÒÈÉ×Ï× ÎÁ ÏÓÎÏ×ÁÎÉÉ
+ÐÏÌÕÞÅÎÎÏÇÏ ÚÅÒËÁÌÁ. ðÏËÁ ÎÅ ÂÕÄÅÍ ÚÁÔÒÁÇÉ×ÁÔØ ÓÏÄÅÒÖÉÍÏÅ ÁÒÈÉ×Ï× mail,
+downloads É work --- ÏÇÒÁÎÉÞÉÍÓÑ cvsroot É archive.
+äÌÑ ÐÒÏÓÔÏÔÙ ÎÅ ÂÕÄÅÍ ÐÒÅÄÐÒÉÎÉÍÁÔØ ÎÉËÁËÉÈ
+ÕÓÉÌÉÊ ÐÏ ÕÄÁÌÅÎÉÀ ÐÕÓÔÙÈ ÁÒÈÉ×Ï×.
+
+%%% ÆÁÊÌ mkincremental0.sh
+\begin{verbatim}
+#!/bin/sh
+
+BASE=/mnt/backups/user/
+ILOGS=$BASE/ilogs/
+ITARS=$BASE/itars/
+BTARS=$BASE/btars/
+
+BASENAME=$1--`date +%Y-%m-%d-%s`
+TARNAME=$BASENAME.tar
+LOGNAME=$BASENAME.log
+LOG0NAME=$1--current.log
+
+cp $ILOGS/$LOG0NAME $ILOGS/$LOGNAME
+
+tar --listed-incremental=$ILOGS/$LOGNAME -cjf $ITARS/$TARNAME.bz2 \
+        $BASE/current/$1/
+
+rm -f $ILOGS/$LOG0NAME
+cp $ILOGS/$LOGNAME $ILOGS/$LOG0NAME
+\end{verbatim}
+
+ óËÒÉÐÔ, ËÏÔÏÒÙÊ ÓÏÚÄÁÓÔ ÎÁÍ ÐÅÒ×ÏÎÁÞÁÌØÎÕÀ ÓÔÒÕËÔÕÒÕ ÉÎËÒÅÍÅÎÔÁÌØÎÙÈ
+ÁÒÈÉ×Ï×:
+
+%%% ÆÁÊÌ initincremental0.sh
+\begin{verbatim}
+#!/bin/sh
+
+BASE=/mnt/backups/user/
+ILOGS=$BASE/ilogs/
+ITARS=$BASE/itars/
+BTARS=$BASE/btars/
+
+rm -f $ILOGS/$1-initial.log
+rm -f $BTARS/$1-base.tar.bz2
+
+tar --listed-incremental=$ILOGS/$1-initial.log \
+       -cjf $BTARS/$1-base.tar.bz2 \
+       $BASE/current/$1/
+
+cp $ILOGS/$1-initial.log $ILOGS/$1--current.log
+
+\end{verbatim}
+
+ óÏÏÔ×ÅÔÓÔ×ÅÎÏ, ÐÅÒÅÄ ÔÅÍ, ËÁË ÎÁÞÁÔØ (ÕÖÅ ÄÏÌÖÎÏ ÓÕÝÅÓÔ×Ï×ÁÔØ ÚÅÒËÁÌÏ), ÍÙ
+×ÙÚÙ×ÁÅÍ ÏÄÉΠÒÁÚ ÓÌÅÄÕÀÝÉÊ ÓËÒÉÐÔ (ËÏÔÏÒÙÊ ÐÏÔÏÍ ÐÏÔÒÅÂÕÅÔÓÑ É ÐÒÉ
+ÒÏÔÁÃÉÑÈ).
+
+%%% ÆÁÊÌ inittars.sh
+\begin{verbatim}
+#!/bin/sh
+
+BASE=/mnt/backups/user/
+ILOGS=$BASE/ilogs/
+ITARS=$BASE/itars/
+BTARS=$BASE/btars/
+
+rm -Rf $ILOGS $ITARS $BTARS
+mkdir -p $ILOGS $ITARS $BTARS
+
+INIT=/home/user/initincremental0.sh
+
+$INIT cvsroot
+$INIT archive
+\end{verbatim}
+