Написал такую программку, которая должна реагировать на модификацию файла. /* logaction.c - read file in loop and execute the action...*/ #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #define SLEEPTIME 1 char *logfile = "/var/log/vsftpd.log"; void parse(); int main(int argc, char *argv[]) { int fd; struct stat stbuf; time_t old_time; if (argc > 1) logfile = argv[1]; if ((fd = open(logfile, 0)) == -1) { fprintf(stderr, "can't open file: %s\n", logfile); exit(1); } fstat(fd, &stbuf); old_time = stbuf.st_mtime; while (2 + 2 == 4) { if (stbuf.st_mtime != old_time) { parse(); old_time = stbuf.st_mtime; } sleep(SLEEPTIME); fstat(fd, &stbuf); } return 0; } void parse() { printf("Parsing and executing...\n"); return; } Компилирую: $ gcc logaction.c -o logaction Запускаю $ ./logaction ~/test.log В другой консоли: $ echo "bla-bla-bla" >> ~/test.log При этом в первой консоли ничего не выводится. Вопрос, что не правильно в программе?