From: vsl Date: Sat, 21 Dec 2002 01:29:16 +0000 (+0000) Subject: some new scripts X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=2193562059f8588d672638463dc2070eeb5c9ba3;p=sites%2Fcsbook.git some new scripts --- diff --git a/chapters/backups.tex b/chapters/backups.tex index e63d664..330c4cb 100644 --- a/chapters/backups.tex +++ b/chapters/backups.tex @@ -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} +