tar kai find
Giorgos Keramidas
charon at labs.gr
Fri Dec 7 00:41:02 EET 2001
On 2001-12-06 22:43:52, Pavlos Parisshs wrote:
> Hello all,
> Paizontas ligo me backup solutions gia to mail dir eida kati
> paraksenw. Exw olla ta mails mou katw apo ton dir /home/paul/Mail
> kai exw ftiaksei ena tar pou exei ta panta mesa.
>
> Otan katevasa nea mail edwsa
> tar -rpPf /home/paul/Mail.tar `find /home/paul/Mail/ -cnewer /home/paul/Mail.tar`
>
> kai eida pws sto tar file afksimenh thn xwtikothta kata 15MB ena
> eixe prosthesei mesa mono 3 mails apo 4-5Kb to kathena!
>
> MIpws kserete giati egine afto?
% man tar
...
-r
--append Append files to the end of an archive. (Does not
work on quarter-inch tapes).
Append. To janalew... prosekse me... APPEND.
Ara to arxiko .tar einai OPWS akribos to hjeres, mono pou sto telos
exei ki alla extra data. Einai logiko na einai megalutero. Gia na
katalabeis giati einai kai akribos TOSO megalutero, mallon prepei na
deis ligo pio prosektika pos douleuei to tar kai me poio binary format
dhmiourgei ta archives tou. Alla den exei toso shmasia. An to
megethos se peirazei na megalonei, mporeis panta na kaneis kati san:
| #!/bin/sh
|
| export tempdir="/tmp/paul.mail.$$"
| export backupmail="/backup/paul/mail.tar.gz"
|
| trap "/bin/rm -fr ${tempdir}" 0 1 2 15
|
| mkdir "${tempdir}" || exit 1
| cd "${tempdir}"
|
| # extract old mail, if backup exists
| test -f "${backupmail}" && \
| tar xzvf "${backupmail}"
|
| # overwrite with new files from HOME
| ( cd / ; tar cpf - home/paul/Mail -cnewer "${backupmail}" ) | \
| tar xpf -
|
| # make new backup tarball
| ( tar cpf "${backupmail}.tmp" home/paul/Mail || \
| /bin/rm -f "${backupmail}.tmp" ) && \
| test -f "${backupmail}.tmp" && \
| mv -f "${backupmail}.tmp" "${backupmail}"
Kai na to baleis sto crontab sou...
-giorgos
PS: Den to exo trejei, apla ena script pou mou katebhke epeidh
bariemai asustola einai auto. Kai fusika den fero kamia eu8unh an
to trejete kai sas sbhsei to disko, sas kapsei to plunthrio, h
genika kanei kati pou den sas egguh8hka rhta oti den to kanei :P
More information about the Linux-greek-users
mailing list