}
}
else
- /* must be a postmaster */
+ /* must be a postmaster */
{
if (postmaster_is_alive((pid_t) pid))
{
}
}
printf(_("%s: no server running\n"), progname);
+
/*
- * The Linux Standard Base Core Specification 3.1 says this should return '3'
- * http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
+ * The Linux Standard Base Core Specification 3.1 says this should return
+ * '3'
+ * http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-ge
+ * neric/iniscrptact.html
*/
exit(3);
}
printf(_(" -D, --pgdata=DATADIR location of the database storage area\n"));
printf(_(" -s, --silent only print errors, no informational messages\n"));
printf(_(" -t, --timeout=SECS seconds to wait when using -w option\n"));
+ printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -w wait until operation completes\n"));
printf(_(" -W do not wait until operation completes\n"));
- printf(_(" --help show this help, then exit\n"));
- printf(_(" --version output version information, then exit\n"));
+ printf(_(" -?, --help show this help, then exit\n"));
printf(_("(The default is to wait for shutdown, but not for start or restart.)\n\n"));
printf(_("If the -D option is omitted, the environment variable PGDATA is used.\n"));
sig = SIGABRT;
#if 0
/* probably should NOT provide SIGKILL */
- else if (strcmp(signame,"KILL") == 0)
+ else if (strcmp(signame, "KILL") == 0)
sig = SIGKILL;
#endif
else if (strcmp(signame, "TERM") == 0)
static void
adjust_data_dir(void)
{
- char cmd[MAXPGPATH], filename[MAXPGPATH], *my_exec_path;
+ char cmd[MAXPGPATH],
+ filename[MAXPGPATH],
+ *my_exec_path;
FILE *fd;
+ /* do nothing if we're working without knowledge of data dir */
+ if (pg_config == NULL)
+ return;
+
/* If there is no postgresql.conf, it can't be a config-only dir */
snprintf(filename, sizeof(filename), "%s/postgresql.conf", pg_config);
if ((fd = fopen(filename, "r")) == NULL)
fd = popen(cmd, "r");
if (fd == NULL || fgets(filename, sizeof(filename), fd) == NULL)
{
- write_stderr(_("%s: cannot find the data directory using %s\n"), progname, my_exec_path);
+ write_stderr(_("%s: could not determine the data directory using command \"%s\"\n"), progname, cmd);
exit(1);
}
pclose(fd);
pg_data = xstrdup(pg_config);
}
+ /* -D might point at config-only directory; if so find the real PGDATA */
adjust_data_dir();
-
+
+ /* Complain if -D needed and not provided */
if (pg_config == NULL &&
ctl_command != KILL_COMMAND && ctl_command != UNREGISTER_COMMAND)
{