From 6b516bf4347dba5c27e09e34bc6739a4b48924c2 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Fri, 14 Oct 2011 22:51:16 +0000 Subject: [PATCH] add daemon mode --- main.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/main.c b/main.c index 1071ad3..b57fa20 100644 --- a/main.c +++ b/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")) {