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

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

Re: alteração


From: cesarakg
Subject: Re: alteração
Date: Fri, 20 Jun 2003 03:02:37 -0000
User-agent: eGroups-EW/0.82

--- Em address@hidden, Junior Mulinari <junior@u...>
escreveu
> 
> Existe alguma forma de fazer um script, que execute um comando somente
> quando algum dado (arquivos) dentro de um diretório for alterado?
> PS.: Não quero executar uma verificação, ou algo semelhante, para não
> consumir cpu da máquina, nem rodar nenhum script em back ground. É
> possível?

A pergunta não é nova, e parece que já a vi algures... De qualquer
forma, resolvi fazer uma pesquisa. A meu ver, a melhor solução seria
que o kernel mesmo te avisasse quando um determinado arquivo for
alterado, e cheguei a esta conclusão vendo uma mensagem do LKML que o
Google
(http://www.google.com/search?q=linux+monitoring+changing+files+directory+-=
network+-proxy)
apontou. Copio aqui o início do arquivo Documentation/dnotify.txt da
minha versão de Linux (que é bem antiga):

                Linux Directory Notification
                ============================

           Stephen Rothwell <address@hidden>

The intention of directory notification is to allow user applications
to be notified when a directory, or any of the files in it, are
changed. The basic mechanism involves the application registering for
notification on a directory using a fcntl(2) call and the
notifications themselves being delivered using signals.

Há até um exemplo em C no mesmo arquivo. Infelizmente a solução não é
usando shell-script, e talvez nem possa ser resolvida usando scripts,
mas espero que seja útil...

[]s
--
Cesar A. K. Grossmann - address@hidden
http://www.LinuxByGrossmann.cjb.net/

Spread the Word - http://www.brokensaints.com/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]