mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 07:06:30 +00:00
repmgrd: add stdout/stderr redirects
This commit is contained in:
31
repmgrd.c
31
repmgrd.c
@@ -63,6 +63,8 @@ main(int argc, char **argv)
|
||||
|
||||
RecordStatus record_status;
|
||||
|
||||
FILE *fd;
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
/* general options */
|
||||
@@ -221,11 +223,38 @@ main(int argc, char **argv)
|
||||
config_file_options.monitoring_history = true;
|
||||
}
|
||||
|
||||
|
||||
fd = freopen("/dev/null", "r", stdin);
|
||||
if (fd == NULL)
|
||||
{
|
||||
fprintf(stderr, "error reopening stdin to \"/dev/null\":\n %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
fd = freopen("/dev/null", "w", stdout);
|
||||
if (fd == NULL)
|
||||
{
|
||||
fprintf(stderr, "error reopening stdout to \"/dev/null\":\n %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
logger_init(&config_file_options, progname());
|
||||
|
||||
if (verbose)
|
||||
logger_set_verbose();
|
||||
|
||||
if (log_type == REPMGR_SYSLOG)
|
||||
{
|
||||
fd = freopen("/dev/null", "w", stderr);
|
||||
|
||||
if (fd == NULL)
|
||||
{
|
||||
fprintf(stderr, "error reopening stderr to \"/dev/null\":\n %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log_info(_("connecting to database \"%s\""),
|
||||
config_file_options.conninfo);
|
||||
|
||||
@@ -334,6 +363,8 @@ main(int argc, char **argv)
|
||||
setup_event_handlers();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
start_monitoring();
|
||||
|
||||
logger_shutdown();
|
||||
|
||||
Reference in New Issue
Block a user