On Sunday 09 July 2006 12:45, Herbert Alexander Faleiros wrote:
[cut]
> size=`du -s "$1" | awk '{print $1}'`
> disc=`expr 50 \* 1024`
>
> for i in `seq 0 $(expr $size / $disc)`; do
>   vols=$vols$(echo -n "-f disc$(printf %03d $i).tar ")
> done
>
> tar -c $vols -M -L $disc "$1"
[cut]

A GPL é para garantir que não vá encontrar o script em algum lugar na net com 
outro autor (acreditem, isso acontece).

Ah, só copiei/colei (o script/explicações) de um outro e-mail que escrevi no 
início do ano em uma lista de Linux (não recordo qual foi).

Outra coisa, se não me engano (não tenho certeza) o tar aguenta até 68G e o 
cpio 8G, talvez a limitação que citou seja do sistema de arquivos.

Melhorando um pouquinho o script (tornando-o funcional):

#!/bin/sh
#
# backup - tar with multi-volumes (files).
# Copyright (C) 2006 Herbert Alexander Faleiros
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Herbert Alexander Faleiros aka ratmmmam <[EMAIL PROTECTED]>
#

# disc size
default=50

function create() {

  size=`du -s "$1" | awk '{print $1}'`
  disc=`expr $default \* 1024`

  for i in `seq 0 $(expr $size / $disc)`; do
    vols=$vols$(echo -n "-f disc$(printf %03d $i).tar ")
  done

  tar -P -c $vols -M -L $disc "$1"
}

function restore() {

  for i in disc*; do
    vols=$vols$(echo -n "-f $i ");
  done;

  tar -x $vols -M
}

case $1 in
  create)
    create $2
  ;;
  restore)
    restore
  ;;
  *)
    echo "Usage: $0 create|restore dir/file"
    exit 1
  ;;
esac


---------------------------------------------------------------------
Esta lista não admite a abordagem de outras liguagens de programação, como 
perl, C etc. Quem insistir em não seguir esta regra será moderado sem prévio 
aviso.
---------------------------------------------------------------------
Sair da lista: [EMAIL PROTECTED]
---------------------------------------------------------------------
Esta lista é moderada de acordo com o previsto em 
http://www.listas-discussao.cjb.net
---------------------------------------------------------------------
Servidor Newsgroup da lista: news.gmane.org
Grupo: gmane.org.user-groups.programming.shell.brazil

 
Links do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/shell-script/

<*> Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
    http://br.yahoo.com/info/utos.html

 


Responder a