<para>
In the absence of fatal errors, <application>pg_receivewal</application>
- will run until terminated by the <systemitem>SIGINT</systemitem> signal
- (<keycombo action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>).
+ will run until terminated by the <systemitem>SIGINT</systemitem>
+ (<keycombo action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>)
+ or <systemitem>SIGTERM</systemitem> signal.
</para>
</refsect1>
<para>
<application>pg_receivewal</application> will exit with status 0 when
- terminated by the <systemitem>SIGINT</systemitem> signal. (That is the
+ terminated by the <systemitem>SIGINT</systemitem> or
+ <systemitem>SIGTERM</systemitem> signal. (That is the
normal way to end it. Hence it is not an error.) For fatal errors or
other signals, the exit status will be nonzero.
</para>
a slot without consuming it, use
<link linkend="functions-replication"><function>pg_logical_slot_peek_changes</function></link>.
</para>
+
+ <para>
+ In the absence of fatal errors, <application>pg_recvlogical</application>
+ will run until terminated by the <systemitem>SIGINT</systemitem>
+ (<keycombo action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>)
+ or <systemitem>SIGTERM</systemitem> signal.
+ </para>
</refsect1>
<refsect1>
</para>
</refsect1>
+ <refsect1>
+ <title>Exit Status</title>
+ <para>
+ <application>pg_recvlogical</application> will exit with status 0 when
+ terminated by the <systemitem>SIGINT</systemitem> or
+ <systemitem>SIGTERM</systemitem> signal. (That is the
+ normal way to end it. Hence it is not an error.) For fatal errors or
+ other signals, the exit status will be nonzero.
+ </para>
+ </refsect1>
+
<refsect1>
<title>Environment</title>
static int compresslevel = 0;
static int noloop = 0;
static int standby_message_timeout = 10 * 1000; /* 10 sec = default */
-static volatile bool time_to_stop = false;
+static volatile sig_atomic_t time_to_stop = false;
static bool do_create_slot = false;
static bool slot_exists_ok = false;
static bool do_drop_slot = false;
}
/*
- * When sigint is called, just tell the system to exit at the next possible
- * moment.
+ * When SIGINT/SIGTERM are caught, just tell the system to exit at the next
+ * possible moment.
*/
#ifndef WIN32
static void
-sigint_handler(int signum)
+sigexit_handler(int signum)
{
time_to_stop = true;
}
* if one is needed, in GetConnection.)
*/
#ifndef WIN32
- pqsignal(SIGINT, sigint_handler);
+ pqsignal(SIGINT, sigexit_handler);
+ pqsignal(SIGTERM, sigexit_handler);
#endif
/*
#ifndef WIN32
/*
- * When sigint is called, just tell the system to exit at the next possible
- * moment.
+ * When SIGINT/SIGTERM are caught, just tell the system to exit at the next
+ * possible moment.
*/
static void
-sigint_handler(int signum)
+sigexit_handler(int signum)
{
time_to_abort = true;
}
* if one is needed, in GetConnection.)
*/
#ifndef WIN32
- pqsignal(SIGINT, sigint_handler);
+ pqsignal(SIGINT, sigexit_handler);
+ pqsignal(SIGTERM, sigexit_handler);
pqsignal(SIGHUP, sighup_handler);
#endif