add daemon mode
This commit is contained in:
parent
d39e1c32b1
commit
6b516bf434
24
main.c
24
main.c
|
@ -803,6 +803,30 @@ nextopt:
|
|||
parse(epgpath, sqlitedump, NULL, filter);
|
||||
sqlitedumpend(argv[1]);
|
||||
}
|
||||
else if (!strcmp(argv[0], "sqlitedumpd") && argc == 2)
|
||||
{
|
||||
time_t last = 0;
|
||||
for (;;)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(epgpath, &st) == -1)
|
||||
{
|
||||
perror("stat");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (st.st_mtime > last)
|
||||
{
|
||||
printf("epgd: DB time %ld > last %ld\n", st.st_mtime, last);
|
||||
sqlitedumpstart(argv[1]);
|
||||
parse(epgpath, sqlitedump, NULL, filter);
|
||||
sqlitedumpend(argv[1]);
|
||||
}
|
||||
last = st.st_mtime;
|
||||
sleep(900);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp(argv[0], "now"))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue