Timeout added tu checksensor
git-svn-id: file:///home/jan/tmp/wetterstation/trunk@74 dd492736-c11a-0410-ad51-8c26713eaf7f
This commit is contained in:
parent
a4f6cbd071
commit
f5a3cc4a67
|
|
@ -69,7 +69,7 @@ static void exit_sig_handler(int);
|
||||||
static void generate_conn_string(){
|
static void generate_conn_string(){
|
||||||
if(conn_string == NULL){
|
if(conn_string == NULL){
|
||||||
conn_string = malloc(sizeof(char)*BUFFSIZE);
|
conn_string = malloc(sizeof(char)*BUFFSIZE);
|
||||||
snprintf(conn_string, BUFFSIZE, "host=%s dbname=%s user=%s password=%s", global_opts.pg_host, global_opts.pg_database, global_opts.pg_user, global_opts.pg_pass);
|
snprintf(conn_string, BUFFSIZE, "host=%s dbname=%s user=%s password=%s connect_timeout=%s", global_opts.pg_host, global_opts.pg_database, global_opts.pg_user, global_opts.pg_pass, global_opts.pg_timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -336,6 +336,7 @@ int main(int argc, char *argv[]){
|
||||||
DEBUGOUT2(" User = %s\n",global_opts.pg_user);
|
DEBUGOUT2(" User = %s\n",global_opts.pg_user);
|
||||||
DEBUGOUT2(" Passwd = %s\n",global_opts.pg_pass);
|
DEBUGOUT2(" Passwd = %s\n",global_opts.pg_pass);
|
||||||
DEBUGOUT2(" Datenbank = %s\n",global_opts.pg_database);
|
DEBUGOUT2(" Datenbank = %s\n",global_opts.pg_database);
|
||||||
|
DEBUGOUT2(" Timeout = %s\n",global_opts.pg_timeout);
|
||||||
|
|
||||||
generate_conn_string();
|
generate_conn_string();
|
||||||
if(global_opts.id_from_db)
|
if(global_opts.id_from_db)
|
||||||
|
|
|
||||||
|
|
@ -24,3 +24,4 @@ pg_host localhost
|
||||||
pg_user user
|
pg_user user
|
||||||
pg_pass pass
|
pg_pass pass
|
||||||
pg_database wetter
|
pg_database wetter
|
||||||
|
pg_timeout 30
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ typedef struct {
|
||||||
char *pg_user; /* Postgres-Username */
|
char *pg_user; /* Postgres-Username */
|
||||||
char *pg_pass; /* Postgres-Password */
|
char *pg_pass; /* Postgres-Password */
|
||||||
char *pg_database; /* Postgres-Datenbank */
|
char *pg_database; /* Postgres-Datenbank */
|
||||||
|
char *pg_timeout; /* Postgres-Timeout */
|
||||||
char *mail_host; /* Hostname (oder ip) des Mailservers */
|
char *mail_host; /* Hostname (oder ip) des Mailservers */
|
||||||
int mail_port; /* Port des Mailservers */
|
int mail_port; /* Port des Mailservers */
|
||||||
char mail_ssl; /* Flag ob SSL (TLS) genutzt werden soll */
|
char mail_ssl; /* Flag ob SSL (TLS) genutzt werden soll */
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ static const struct config_keyword keywords[] = {
|
||||||
{"pg_user", read_str, &(global_opts.pg_user), DEFAULT_PG_USER},
|
{"pg_user", read_str, &(global_opts.pg_user), DEFAULT_PG_USER},
|
||||||
{"pg_pass", read_str, &(global_opts.pg_pass), DEFAULT_PG_PASS},
|
{"pg_pass", read_str, &(global_opts.pg_pass), DEFAULT_PG_PASS},
|
||||||
{"pg_database", read_str, &(global_opts.pg_database), DEFAULT_PG_DATABASE},
|
{"pg_database", read_str, &(global_opts.pg_database), DEFAULT_PG_DATABASE},
|
||||||
|
{"pg_timeout", read_str, &(global_opts.pg_timeout), DEFAULT_PG_TIMEOUT},
|
||||||
{"", NULL, NULL, ""}
|
{"", NULL, NULL, ""}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#define DEFAULT_PG_USER "localuser" /* Postgres-Username */
|
#define DEFAULT_PG_USER "localuser" /* Postgres-Username */
|
||||||
#define DEFAULT_PG_PASS "" /* Postgres-Passwort */
|
#define DEFAULT_PG_PASS "" /* Postgres-Passwort */
|
||||||
#define DEFAULT_PG_DATABASE "localbase" /* Postgres-Datenbank */
|
#define DEFAULT_PG_DATABASE "localbase" /* Postgres-Datenbank */
|
||||||
|
#define DEFAULT_PG_TIMEOUT "20" /* Postgres-Timeout */
|
||||||
#define DEFAULT_CONFIG_FILE "./checksensor.conf" /* Standart-Configdatei */
|
#define DEFAULT_CONFIG_FILE "./checksensor.conf" /* Standart-Configdatei */
|
||||||
#define DEFAULT_CHECK_INTERVAL "24" /* Standart-Interval, indem der Sensor das letzte mal hätte senden sollen (in h) */
|
#define DEFAULT_CHECK_INTERVAL "24" /* Standart-Interval, indem der Sensor das letzte mal hätte senden sollen (in h) */
|
||||||
#define DEFAULT_MIN_SENDINGS "24" /* Standart-Wert, wieviele Daten der Sensor in den letzten x stunden hätte senden sollen */
|
#define DEFAULT_MIN_SENDINGS "24" /* Standart-Wert, wieviele Daten der Sensor in den letzten x stunden hätte senden sollen */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue