X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=innduct.git;a=blobdiff_plain;f=duct.c;h=55b98772da9d9f533ead5e1a4754add0ad9ef7b9;hp=6ff7bad88db1aae929265824361daef6eea77df4;hb=b350fb6533f6855e54050aec6d69cfd0e27e239e;hpb=c153b3acbb7844e8dab5e86ad1cd64d34ce7aa92 diff --git a/duct.c b/duct.c index 6ff7bad..55b9877 100644 --- a/duct.c +++ b/duct.c @@ -1,7 +1,7 @@ /* * innduct * tailing reliable realtime streaming feeder for inn - * innduct.c - main program, option parsing and startup + * duct.c - main program, option parsing and startup * * Copyright (C) 2010 Ian Jackson * @@ -44,6 +44,7 @@ pid_t self_pid; int *lowvol_perperiod; int lowvol_circptr; int lowvol_total; /* does not include current period */ +int until_stats_log=1; /*---------- configuration option variables ----------*/ /* when changing defaults, remember to update the manpage */ @@ -77,6 +78,7 @@ int backlog_spontrescan_periods=300; int spontaneous_flush_periods=100000; int max_separated_periods=2000; int need_activity_periods=1000; +int stats_log_periods=2500; int lowvol_thresh=3; int lowvol_periods=1000; @@ -169,6 +171,9 @@ void period(void) { free(dipf_flushing); free(dipf_backlog); + if (until_stats_log) until_stats_log--; + else showstats(); + if (until_connect) until_connect--; inputfile_queue_check_expired(backlog_input_file); @@ -378,6 +383,7 @@ static const Option innduct_options[]= { {0,"max-flush-interval", "PERIOD", &spontaneous_flush_periods,op_seconds }, {0,"flush-finish-timeout", "PERIOD", &max_separated_periods, op_seconds }, {0,"idle-timeout", "PERIOD", &need_activity_periods, op_seconds }, +{0,"stats-log-interval", "PERIOD", &stats_log_periods, op_seconds }, {0,"low-volume-thresh", "PERIOD", &lowvol_thresh, op_integer }, {0,"low-volume-window", "PERIOD", &lowvol_periods, op_seconds }, @@ -393,6 +399,14 @@ static void printusage(FILE *f) { print_options(innduct_options, f); } +static void printcopyright(FILE *f) { + fputs( + "innduct is Copyright (C)2010 Ian Jackson.\n" + "It is free software, licenced under GPL version 3 or later.\n" + "It is provided WITHOUT ANY WARRANTY. See the file GPL-3 for details\n", + stderr); +} + static void help(const Option *o, const char *val) { printusage(stdout); if (ferror(stdout) || fflush(stdout)) { @@ -426,6 +440,7 @@ int main(int argc, char **argv) { if (!argv[1]) { printusage(stderr); + printcopyright(stderr); exit(8); } @@ -463,6 +478,7 @@ int main(int argc, char **argv) { convert_to_periods_rndup(&spontaneous_flush_periods); convert_to_periods_rndup(&max_separated_periods); convert_to_periods_rndup(&need_activity_periods); + convert_to_periods_rndup(&stats_log_periods); convert_to_periods_rndup(&lowvol_periods); if (max_bad_data_ratio < 0 || max_bad_data_ratio > 100) @@ -540,13 +556,13 @@ int main(int argc, char **argv) { dup2(null,2); xclose(null, "/dev/null original fd",0); - pid_t child1= xfork("daemonise first fork"); + pid_t child1= xfork_bare("daemonise first fork"); if (child1) _exit(0); pid_t sid= setsid(); if (sid == -1) sysdie("setsid failed"); - pid_t child2= xfork("daemonise second fork"); + pid_t child2= xfork_bare("daemonise second fork"); if (child2) _exit(0); }