shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



>From address@hidden Fri Feb 22 12:31:29 2008
Return-Path: <address@hidden>
X-Sender: address@hidden
X-Apparently-To: address@hidden
X-Received: (qmail 40573 invoked from network); 22 Feb 2008 20:31:29 -0000
X-Received: from unknown (66.218.66.71)
  by m57.grp.scd.yahoo.com with QMQP; 22 Feb 2008 20:31:29 -0000
X-Received: from unknown (HELO hs-out-0708.google.com) (64.233.178.240)
  by mta13.grp.scd.yahoo.com with SMTP; 22 Feb 2008 20:31:28 -0000
X-Received: by hs-out-0708.google.com with SMTP id m63so382632hsc.13
        for <address@hidden>; Fri, 22 Feb 2008 12:31:28 -0800 (PST)
X-Received: by 10.100.178.13 with SMTP id a13mr890696anf.63.1203712287732;
        Fri, 22 Feb 2008 12:31:27 -0800 (PST)
X-Received: by 10.100.209.15 with HTTP; Fri, 22 Feb 2008 12:31:27 -0800 (PST)
Message-ID: <address@hidden>
Date: Fri, 22 Feb 2008 17:31:27 -0300
To: address@hidden
In-Reply-To: <address@hidden>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
References: <address@hidden>
X-Originating-IP: 64.233.178.240
X-eGroups-Msg-Info: 1:12:0:0:0
From: "Tiago Barcellos Peczenyj" <address@hidden>
Subject: Re: [shell-script] Re: Verificar arquivo na Internet
X-Yahoo-Group-Post: member; u=204465305; 
y=BibV09HdqtpIsDRaCmGCwFT-PBPAwO6kEwCCWIpd-wMVuZlQd9o
X-Yahoo-Profile: grande_uosh

Q tal usar o curl para fazer um head ?

URL=3Dwww.google.com.br/intl/pt-BR_br/images/logo.gif
curl -sI ${URL} | sed -n '/Last-Modified: */{ s///; p }'

Wed, 07 Jun 2006 19:50:30 GMT

calculando o timestamp:

DATE=3D$( curl -sI ${URL} | sed -n '/Last-Modified: */{ s///; p }' )
date -d "${DATE}" +"%s"
1149709830

Ou ent=E3o baixa o arquivo e compara o md5sum

2008/2/22 mop <address@hidden>:
> Boa Fernando!!!
>
>  Para o caso de um m=EDsero sistema, s=F3 com shell, uma solu=E7=E3o 100%=
 bash, desde
>  que este tenha sido compilado com suporte a tcp:
>
>  exec 3<>/dev/tcp/www.google.com.br/80
>  D=3D;echo -e "HEAD /intl/pt-BR_br/images/logo.gif HTTP/1.1\r\n\r\n" >&3
>  while read -t9 L;do [ ${L%% *} =3D=3D Last-Modified: ]&&D=3D${L#* }&&bre=
ak;done<&3
>  exec 3<&-
>
>  Sorry, I am a shell fan! :)
>
>  Caso a data no download n=E3o esteja sendo preservada, =E9 poss=EDvel in=
serir no
>  script uma linha com:
>  touch -d "$D" file
>
>  Da=ED a cada checagem =E9 s=F3 verificar se $D =E9 igual a:
>  date -r file
>
>
>  ------------------------------------------------------------------
>  >From: Fernando Lemes da Silva
>
> >
>  >Vamos supor que voce baixe o arquivo e anote a data e hora dele no serv=
idor
>  >remoto. Para saber se o arquivo foi modificado basta comparar a data.. =
algo
>  >como:
>  >
>  >(echo -e "HEAD www.google.com.br/intl/pt-BR_br/images/logo.gif
>  >HTTP/1.1
>  >Host: www.google.com.br
>
> >
>  "; sleep 3) |
>  >nc www.google.com.br 80 |
>  >grep "Last-Modified:"
>  >
>  >Isto ir=E1 pegar o header "Last-Modified" da requisi=E7=E3o... logo voc=
e saber=E1
>  >quando o arquivo mudar. Espero que lhe ajude.
>
>
>
>
> ---------------------------------------------------------------------
>  Esta lista n=E3o admite a abordagem de outras liguagens de programa=E7=
=E3o, como perl, C etc. Quem insistir em n=E3o seguir esta regra ser=E1 mod=
erado sem pr=E9vio aviso.
>  ---------------------------------------------------------------------
>  Sair da lista: address@hidden
>  ---------------------------------------------------------------------
>  Esta lista =E9 moderada de acordo com o previsto em http://www.listas-di=
scussao.cjb.net
>  ---------------------------------------------------------------------
>  Servidor Newsgroup da lista: news.gmane.org
>  Grupo: gmane.org.user-groups.programming.shell.brazil
>
>
>  Links do Yahoo! Grupos
>
>     address@hidden
>
>
>



--=20
Tiago B Peczenyj
Linux User #405772

http://peczenyj.blogspot.com/
"what does not kill us makes us stronger"


reply via email to

From: Unknown
[Prev in Thread] Current Thread [Next in Thread]