1<refentry id="repmgr-daemon-stop">
2  <indexterm>
3    <primary>repmgr daemon stop</primary>
4  </indexterm>
5
6  <indexterm>
7    <primary>repmgrd</primary>
8    <secondary>stopping</secondary>
9  </indexterm>
10
11  <refmeta>
12    <refentrytitle>repmgr daemon stop</refentrytitle>
13  </refmeta>
14
15  <refnamediv>
16    <refname>repmgr daemon stop</refname>
17    <refpurpose>Stop the &repmgrd; daemon on the local node</refpurpose>
18  </refnamediv>
19
20  <refsect1>
21    <title>Description</title>
22    <para>
23      This command stops the &repmgrd; daemon on the
24      local node.
25    </para>
26
27    <para>
28      By default, &repmgr; will wait for up to 15 seconds to confirm that &repmgrd;
29      stopped. This behaviour can be overridden by specifying a diffent value using the <option>--wait</option>
30      option, or disabled altogether with the <option>--no-wait</option> option.
31    </para>
32    <note>
33      <para>
34        If PostgreSQL is not running on the local node, under some circumstances &repmgr; may not
35        be able to confirm if &repmgrd; has actually stopped.
36      </para>
37    </note>
38
39   <important>
40      <para>
41        The <filename>repmgr.conf</filename> parameter <varname>repmgrd_service_stop_command</varname>
42        must be set for <command>repmgr daemon stop</command> to work; see section
43        <xref linkend="repmgr-daemon-stop-configuration"/> for details.
44      </para>
45    </important>
46  </refsect1>
47
48  <refsect1>
49    <title>Configuration</title>
50    <para>
51      <command>repmgr daemon stop</command> will execute the command defined by the
52      <varname>repmgrd_service_stop_command</varname> parameter in <filename>repmgr.conf</filename>.
53      This must be set to a shell command which will stop &repmgrd;;
54      if &repmgr; was installed from a package, this will be the service command defined by the
55      package. For more details see <link linkend="appendix-packages">Appendix: &repmgr; package details</link>.
56    </para>
57
58    <important>
59      <para>
60        If &repmgr; was installed from a system package, and you do not configure
61        <varname>repmgrd_service_stop_command</varname> to an appropriate service command, this may
62        result in the system becoming confused about the state of the &repmgrd;
63        service; this is particularly the case with <literal>systemd</literal>.
64      </para>
65    </important>
66
67  </refsect1>
68
69  <refsect1>
70
71    <title>Options</title>
72
73    <variablelist>
74
75      <varlistentry>
76        <term><option>--dry-run</option></term>
77        <listitem>
78          <para>
79            Check prerequisites but don't actually attempt to stop &repmgrd;.
80          </para>
81          <para>
82            This action will output the command which would be executed.
83          </para>
84        </listitem>
85      </varlistentry>
86
87      <varlistentry>
88        <term><option>-w</option></term>
89        <term><option>--wait</option></term>
90        <listitem>
91          <para>
92            Wait for the specified number of seconds to confirm that &repmgrd;
93            stopped successfully.
94          </para>
95          <para>
96            Note that providing <option>--wait=0</option> is the equivalent of <option>--no-wait</option>.
97          </para>
98
99         </listitem>
100      </varlistentry>
101
102      <varlistentry>
103        <term><option>--no-wait</option></term>
104        <listitem>
105          <para>
106            Don't wait to confirm that &repmgrd;
107            stopped successfully.
108          </para>
109          <para>
110            This is equivalent to providing <option>--wait=0</option>.
111          </para>
112         </listitem>
113      </varlistentry>
114    </variablelist>
115  </refsect1>
116
117  <refsect1 id="repmgr-daemon-stop-configuration" xreflabel="repmgr daemon stop configuration">
118    <title>Configuration file settings</title>
119    <para>
120     The following parameter in <filename>repmgr.conf</filename> is relevant
121     to <command>repmgr daemon stop</command>:
122    </para>
123
124    <variablelist>
125
126      <varlistentry>
127
128        <term><option>repmgrd_service_stop_command</option></term>
129        <listitem>
130          <indexterm>
131            <primary>repmgrd_service_stop_command</primary>
132          <secondary>with &quot;repmgr daemon stop&quot;</secondary>
133          </indexterm>
134
135          <para>
136            <command>repmgr daemon stop</command> will execute the command defined by the
137            <varname>repmgrd_service_stop_command</varname> parameter in <filename>repmgr.conf</filename>.
138            This must be set to a shell command which will stop &repmgrd;;
139            if &repmgr; was installed from a package, this will be the service command defined by the
140            package. For more details see <link linkend="appendix-packages">Appendix: &repmgr; package details</link>.
141          </para>
142          <important>
143            <para>
144              If &repmgr; was installed from a system package, and you do not configure
145              <varname>repmgrd_service_stop_command</varname> to an appropriate service command, this may
146              result in the system becoming confused about the state of the &repmgrd;
147              service; this is particularly the case with <literal>systemd</literal>.
148            </para>
149          </important>
150        </listitem>
151      </varlistentry>
152    </variablelist>
153
154  </refsect1>
155
156  <refsect1>
157    <title>Exit codes</title>
158    <para>
159      One of the following exit codes will be emitted by <command>repmgr daemon stop</command>:
160    </para>
161    <variablelist>
162
163      <varlistentry>
164        <term><option>SUCCESS (0)</option></term>
165        <listitem>
166          <para>
167            &repmgrd; could be stopped.
168          </para>
169        </listitem>
170      </varlistentry>
171
172      <varlistentry>
173        <term><option>ERR_BAD_CONFIG (1)</option></term>
174        <listitem>
175          <para>
176            <varname>repmgrd_service_stop_command</varname> is not defined in
177            <filename>repmgr.conf</filename>.
178          </para>
179        </listitem>
180      </varlistentry>
181
182      <varlistentry>
183        <term><option>ERR_REPMGRD_SERVICE (27)</option></term>
184        <listitem>
185          <para>
186            &repmgrd; could not be stopped.
187          </para>
188        </listitem>
189      </varlistentry>
190
191    </variablelist>
192  </refsect1>
193
194  <refsect1>
195    <title>See also</title>
196    <para>
197      <xref linkend="repmgr-daemon-start"/>,
198      <xref linkend="repmgrd-daemon"/>,
199      <xref linkend="repmgr-service-status"/>,
200      <xref linkend="repmgr-service-pause"/>,
201      <xref linkend="repmgr-service-unpause"/>
202    </para>
203  </refsect1>
204
205</refentry>
206