diff options
Diffstat (limited to '')
-rw-r--r-- | daemon.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/daemon.c b/daemon.c index 3cfe24f..2e58c82 100644 --- a/daemon.c +++ b/daemon.c @@ -48,8 +48,9 @@ #define WS " \t" -struct timespec restartInterval = { .tv_sec = 1 }; struct Set256 stopExits; +struct timespec restartInterval = { .tv_sec = 1 }; +struct timespec resetInterval = { .tv_sec = 15 * 60 }; static volatile sig_atomic_t signals[NSIG]; static void signalHandler(int signal) { @@ -176,10 +177,10 @@ static void parseExits(char *list) { } } -static void parseInterval(const char *millis) { +static void parseInterval(struct timespec *interval, const char *millis) { unsigned long ms = strtoul(millis, NULL, 10); - restartInterval.tv_sec = ms / 1000; - restartInterval.tv_nsec = 1000000 * (ms % 1000); + interval->tv_sec = ms / 1000; + interval->tv_nsec = 1000000 * (ms % 1000); } static void setTitle(void) { @@ -208,7 +209,7 @@ int main(int argc, char *argv[]) { const char *userName = NULL; const char *groupName = NULL; - for (int opt; 0 < (opt = getopt(argc, argv, "C:c:df:g:p:s:t:u:"));) { + for (int opt; 0 < (opt = getopt(argc, argv, "C:c:df:g:p:r:s:t:u:"));) { switch (opt) { break; case 'C': serviceDir = optarg; break; case 'c': fifoPath = optarg; @@ -216,8 +217,9 @@ int main(int argc, char *argv[]) { break; case 'f': configPath = optarg; break; case 'g': groupName = optarg; break; case 'p': pidPath = optarg; + break; case 'r': parseInterval(&resetInterval, optarg); break; case 's': parseExits(optarg); - break; case 't': parseInterval(optarg); + break; case 't': parseInterval(&restartInterval, optarg); break; case 'u': userName = optarg; break; default: return EX_USAGE; } |