2010-07-06 5 views

답변

10

리눅스에는 파일 시스템의 변경 사항을 응용 프로그램에보고 할 수있는 서브 시스템 호출 inotify이 있습니다.

리눅스 시스템에는 incron이라는 패키지가있어 inotify을 매우 쉽게 사용할 수 있습니다. (또는 설명에 'inotify'라는 단어가 포함 된 패키지가 있으면 사용 가능한 패키지를 검색하십시오.)

cron은 지정된 날짜와 시간에 스크립트를 실행하는 반면 제외 cron을 설정처럼 매우 incron입니다 설정, incron 스크립트 때마다 지정된 파일이나 디렉토리 변경을 실행합니다.

추신. (예를 들어) 우분투에서 incronthis package 내가 같은 일을하려고했다

sudo apt-get install incron 
0

설치하고 나를 위해 그것을 할 수있는 파이썬 스크립트를 작성 결국됩니다.

https://github.com/bawigga/spy

사용 :

$ ./spy myscript.py 
... your script output ... 

$ ./spy --help 
Usage: spy [OPTIONS] [WATCH] 

Options: 
    --version    show program's version number and exit 
    -h, --help   show this help message and exit 
    -c, --clear   clear the screen after each execution 
    -e COMMAND, --exec=COMMAND 
         path to the program to execute 
    -i INTERVAL, --interval=INTERVAL 
         (in seconds) set the time interval to check for file 
         modifications 
관련 문제