Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc8702dc

Browse files
committed
Propogate pg_ctl -D to the postmaster for command-line identification.
1 parent7531d2f commitc8702dc

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.26 2004/08/2821:01:38 momjian Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.27 2004/08/2822:04:01 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -67,6 +67,7 @@ static ShutdownMode shutdown_mode = SMART_MODE;
6767
staticintsig=SIGTERM;/* default */
6868
staticCtlCommandctl_command=NO_COMMAND;
6969
staticchar*pg_data=NULL;
70+
staticchar*pgdata_opt=NULL;
7071
staticchar*post_opts=NULL;
7172
staticconstchar*progname;
7273
staticchar*log_file=NULL;
@@ -309,19 +310,20 @@ start_postmaster(void)
309310
*/
310311
if (log_file!=NULL)
311312
#ifndefWIN32
312-
snprintf(cmd,MAXPGPATH,"%s\"%s\" %s < \"%s\" >> \"%s\" 2>&1 &%s",
313+
snprintf(cmd,MAXPGPATH,"%s\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1 &%s",
313314
#else
314-
snprintf(cmd,MAXPGPATH,"%sSTART /B \"\" \"%s\" %s < \"%s\" >> \"%s\" 2>&1%s",
315+
snprintf(cmd,MAXPGPATH,"%sSTART /B \"\" \"%s\" %s%s < \"%s\" >> \"%s\" 2>&1%s",
315316
#endif
316-
SYSTEMQUOTE,postgres_path,post_opts,DEVNULL,log_file,
317-
SYSTEMQUOTE);
317+
SYSTEMQUOTE,postgres_path,pgdata_opt,post_opts,
318+
DEVNULL,log_file,SYSTEMQUOTE);
318319
else
319320
#ifndefWIN32
320-
snprintf(cmd,MAXPGPATH,"%s\"%s\" %s < \"%s\" 2>&1 &%s",
321+
snprintf(cmd,MAXPGPATH,"%s\"%s\" %s%s < \"%s\" 2>&1 &%s",
321322
#else
322-
snprintf(cmd,MAXPGPATH,"%sSTART /B \"\" \"%s\" %s < \"%s\" 2>&1%s",
323+
snprintf(cmd,MAXPGPATH,"%sSTART /B \"\" \"%s\" %s%s < \"%s\" 2>&1%s",
323324
#endif
324-
SYSTEMQUOTE,postgres_path,post_opts,DEVNULL,SYSTEMQUOTE);
325+
SYSTEMQUOTE,postgres_path,pgdata_opt,post_opts,
326+
DEVNULL,SYSTEMQUOTE);
325327

326328
returnsystem(cmd);
327329
}
@@ -494,6 +496,10 @@ do_start(void)
494496
}
495497
}
496498

499+
/* No -D or -D already added during server start */
500+
if (ctl_command==RESTART_COMMAND||pgdata_opt==NULL)
501+
pgdata_opt="";
502+
497503
if (postgres_path==NULL)
498504
{
499505
char*postmaster_path;
@@ -1210,6 +1216,9 @@ main(int argc, char **argv)
12101216
env_var=xmalloc(len+8);
12111217
snprintf(env_var,len+8,"PGDATA=%s",optarg);
12121218
putenv(env_var);
1219+
/* Show -D for easier postmaster 'ps' identification */
1220+
pgdata_opt=xmalloc(len+7);
1221+
snprintf(pgdata_opt,len+7,"-D \"%s\" ",optarg);
12131222
break;
12141223
}
12151224
case'l':

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp