mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
repmgrd: enable package to supply default PID file path
Also add documentation for packagers about paths which can be patched as default package values.
This commit is contained in:
@@ -364,4 +364,48 @@
|
|||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
|
<sect1 id="packages-packager-info" xreflabel="Information for packagers">
|
||||||
|
<title>Information for packagers</title>
|
||||||
|
<indexterm>
|
||||||
|
<primary>packages</primary>
|
||||||
|
<secondary>information for packagers</secondary>
|
||||||
|
</indexterm>
|
||||||
|
<para>
|
||||||
|
We recommend patching the following parameters when
|
||||||
|
building the package as built-in default values for user convenience.
|
||||||
|
These values can nevertheless be overridden by the user, if desired.
|
||||||
|
</para>
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Configuration file location: the default configuration file location
|
||||||
|
can be hard-coded by patching <varname>package_conf_file</varname>
|
||||||
|
in <filename>configfile.c</filename>:
|
||||||
|
<programlisting>
|
||||||
|
/* packagers: if feasible, patch configuration file path into "package_conf_file" */
|
||||||
|
char package_conf_file[MAXPGPATH] = "";</programlisting>
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
See also: <xref linkend="configuration-file">
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
PID file location: the default <application>repmgrd</application> PID file
|
||||||
|
location can be hard-coded by patching <varname>package_pid_file</varname>
|
||||||
|
in <filename>repmgrd.c</filename>:
|
||||||
|
<programlisting>
|
||||||
|
/* packagers: if feasible, patch PID file path into "package_pid_file" */
|
||||||
|
char package_pid_file[MAXPGPATH] = "";</programlisting>
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
See also: <xref linkend="repmgrd-pid-file">
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
|
</itemizedlist>
|
||||||
|
</sect1>
|
||||||
</appendix>
|
</appendix>
|
||||||
|
|||||||
@@ -170,11 +170,15 @@
|
|||||||
running <application>repmgrd</application> daemon.
|
running <application>repmgrd</application> daemon.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect2 id="repmgrd-pid-file">
|
<sect2 id="repmgrd-pid-file" xreflabel="repmgrd's PID file">
|
||||||
<indexterm>
|
<indexterm>
|
||||||
<primary>repmgrd</primary>
|
<primary>repmgrd</primary>
|
||||||
<secondary>PID file</secondary>
|
<secondary>PID file</secondary>
|
||||||
</indexterm>
|
</indexterm>
|
||||||
|
<indexterm>
|
||||||
|
<primary>PID file</primary>
|
||||||
|
<secondary>repmgrd</secondary>
|
||||||
|
</indexterm>
|
||||||
<title>repmgrd's PID file</title>
|
<title>repmgrd's PID file</title>
|
||||||
<para>
|
<para>
|
||||||
<application>repmgrd</application> will generate a PID file by default.
|
<application>repmgrd</application> will generate a PID file by default.
|
||||||
@@ -197,16 +201,21 @@
|
|||||||
<option>--pid-file</option> may be deprecated in future releases.
|
<option>--pid-file</option> may be deprecated in future releases.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If no PID file is specified, <application>repmgrd</application> will create one
|
If a PID file location was specified by the package maintainer, <application>repmgrd</application>
|
||||||
in the operating system's temporary directory (determined by the environment variable
|
will use that. This only applies if &repmgr; was installed from a package and the package
|
||||||
<varname>TMPDIR</varname>, or if that is not set, will use <filename>/tmp</filename>.
|
maintainer has specified the PID file location.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
If none of the above apply, <application>repmgrd</application> will create a PID file
|
||||||
|
in the operating system's temporary directory (das etermined by the environment variable
|
||||||
|
<varname>TMPDIR</varname>, or if that is not set, will use <filename>/tmp</filename>).
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
To prevent a PID file being generated at all, provide the command line option
|
To prevent a PID file being generated at all, provide the command line option
|
||||||
<option>--no-pid-file</option>.
|
<option>--no-pid-file</option>.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
To see which PID file would use, execute <application>repmgrd</application>
|
To see which PID file <application>repmgrd</application> would use, execute <application>repmgrd</application>
|
||||||
with the option <option>--show-pid-file</option>. <application>repmgrd</application>
|
with the option <option>--show-pid-file</option>. <application>repmgrd</application>
|
||||||
will not start if this option is provided. Note that the value shown is the
|
will not start if this option is provided. Note that the value shown is the
|
||||||
file <application>repmgrd</application> would use next time it starts, and is
|
file <application>repmgrd</application> would use next time it starts, and is
|
||||||
|
|||||||
18
repmgrd.c
18
repmgrd.c
@@ -275,12 +275,22 @@ main(int argc, char **argv)
|
|||||||
/* no pid file provided - determine location */
|
/* no pid file provided - determine location */
|
||||||
if (pid_file[0] == '\0')
|
if (pid_file[0] == '\0')
|
||||||
{
|
{
|
||||||
const char *tmpdir = getenv("TMPDIR");
|
/* packagers: if feasible, patch PID file path into "package_pid_file" */
|
||||||
|
char package_pid_file[MAXPGPATH] = "";
|
||||||
|
|
||||||
if (!tmpdir)
|
if (package_pid_file[0] != '\0')
|
||||||
tmpdir = "/tmp";
|
{
|
||||||
|
maxpath_snprintf(pid_file, "%s", package_pid_file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char *tmpdir = getenv("TMPDIR");
|
||||||
|
|
||||||
maxpath_snprintf(pid_file, "%s/repmgrd.pid", tmpdir);
|
if (!tmpdir)
|
||||||
|
tmpdir = "/tmp";
|
||||||
|
|
||||||
|
maxpath_snprintf(pid_file, "%s/repmgrd.pid", tmpdir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user