%.o: $(USUAL_DIR)/usual/%.c $(USUAL_HDRS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c -o $@ $<
+pgqd.o: pgqd.ini.h
+pgqd.ini.h: pgqd.ini
+ sed -e 's/.*/"&\\n"/' $< > $@
+
install: all
mkdir -p '$(DESTDIR)$(bindir)'
$(BININSTALL) -m 755 pgqd$(X) '$(DESTDIR)$(bindir)/pgqd'
$(INSTALL) -m 644 pgqd.ini '$(DESTDIR)$(docdir)/conf/pgqd.ini.templ'
clean:
- rm -f $(PROGRAM) $(OBJS)
+ rm -f $(PROGRAM) $(OBJS) pgqd.ini.h
tags:
ctags *.[ch] ../../lib/usual/*.[ch]
static const char *usage_str =
"usage: pgq-ticker [switches] config.file\n"
"Switches:\n"
-" -H Show help\n"
" -v Increase verbosity\n"
" -q No output to console\n"
-" -V Show version\n"
" -d Daemonize\n"
+" -H Show help\n"
+" -V Show version\n"
+" --ini Show sample config file\n"
"";
+static const char *sample_ini =
+#include "pgqd.ini.h"
+;
+
struct Config cf;
static struct PgSocket *db_template;
static void handle_sighup(int sock, short flags, void *arg)
{
- log_info("Got SIGHUP re-reading config");
+ log_info("Got SIGHUP, re-reading config");
load_config(true);
recheck_dbs();
}
int c;
bool daemon = false;
+ for (c = 1; c < argc; c++) {
+ if (!strcmp(argv[c], "--ini")) {
+ printf("%s", sample_ini);
+ exit(0);
+ }
+ }
+
while ((c = getopt(argc, argv, "dqvhV")) != -1) {
switch (c) {
case 'd':
[pgqd]
# where to log
-logfile = my.log
+logfile =
# pidfile
-pidfile = my.pid
+pidfile =
-# how often to check for new databases
-check_period = 60
-
-# how often to flush retry queue
-retry_period = 15
-
-# how often to do maintentance
-maint_period = 120
-
-# how often to run ticker
-ticker_period = 0.5
+## optional parameters ##
# libpq connect string without dbname=
-base_connstr = host=127.0.0.1
+#base_connstr =
# startup db to query other databases
-initial_database = template1
+#initial_database = template1
-# limit ticker to specific databases (does not work)
-database_list =
+# limit ticker to specific databases
+#database_list =
# log into syslog
-syslog = 0
+#syslog = 0
+
+## optional timeouts ##
+
+# how often to check for new databases
+#check_period = 60
+
+# how often to flush retry queue
+#retry_period = 30
+
+# how often to do maintentance
+#maint_period = 120
+
+# how often to run ticker
+#ticker_period = 1