aBinaryMind

Some thoughts, some info, some rants

Pyinotify

Pyinotify is a pure Python module for monitoring filesystems changes. Pyinotify relies on inotify, a Linux Kernel functionnality (since kernel 2.6.13). inotify is an event-driven notification mechanism, its notifications are exported to user space through three system calls. Pyinotify binds these system calls and provides an implementation on top of them.

via Pyinotify.

Giữ một phiên làm việc SSH

Khi bạn làm việc với máy chủ thông qua SSH thì bạn sẽ thường gặp một vấn đề nhỏ. Đó là dịch vụ SSH sẽ đóng kết nối của bạn sau một khoảng thời gian nhất định. Để ngăn dịch vụ SSH đóng kết nối thì chúng ta có cách sau:

Sửa file

/etc/ssh/ssh_config

hoặc

$HOME/.ssh/config

và thêm vào đó dòng dưới đây

ServerAliveInterval 60

Chương trình C nhỏ dưới đây có thể giúp bạn tạm giữ một phiên làm việc bằng cách in ra một thanh xoay trong lúc chạy.

#include <stdio.h>
int i;
char spin[4] = { '|', '/', '-', 0x5c };
int main() {
    for(i=0;;usleep(300000), fflush(stdout))
        printf("%c\x08", spin[++i%4]);
    return 0;
}
  • 0 Comments
  • Filed under: Linux/Unix, Tips
  • About Me

    I'm an introvert & a geek. If you have enough time, patience and curiosity, please read this and this . After that, I'm sure we're gonna get along very well ;-)

    Bookmarks