#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #define TIMEOUT 20 main() { int fd, buf; fd = open("watchdog", O_WRONLY); if(fd < 0) { perror("Error in open"); exit(1); } while(1) { if(write(fd, &buf, sizeof(buf)) < 0) { perror("Error in write, System may reboot any moment...\n"); exit(1); } sleep(TIMEOUT/2); } }