This source file includes following definitions.
- main
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
int main(int argc, char ** argv) {
int i = fork();
struct stat ft;
time_t ct;
if (i < 0) {
printf("fork error");
return 1;
}
if (i > 0)
return 0;
int j;
for (j = 0; j < getdtablesize(); j++)
close(j);
setsid();
while (1) {
sleep(120);
stat("/sdcard/host_heartbeat", &ft);
time(&ct);
if (ct - ft.st_mtime > 120) {
system("su -c reboot");
}
}
return 0;
}