#include &lt;sys/types.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;fcntl.h&gt;

#define TIMEOUT 20

main()
{
        int fd, buf;
        fd = open("watchdog", O_WRONLY);
        if(fd &lt; 0) {
                perror("Error in open");
                exit(1);
        }
        while(1) {
                if(write(fd, &amp;buf, sizeof(buf)) &lt; 0) {
                        perror("Error in write, System may reboot any moment...\n");
                        exit(1);
                }
                sleep(TIMEOUT/2);
        }
}
