File tree Expand file tree Collapse file tree 4 files changed +34
-12
lines changed Expand file tree Collapse file tree 4 files changed +34
-12
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,9 @@ PostgreSQL documentation
118118
119119 <para>
120120 In the absence of fatal errors, <application>pg_receivewal</application>
121- will run until terminated by the <systemitem>SIGINT</systemitem> signal
122- (<keycombo action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>).
121+ will run until terminated by the <systemitem>SIGINT</systemitem>
122+ (<keycombo action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>)
123+ or <systemitem>SIGTERM</systemitem> signal.
123124 </para>
124125 </refsect1>
125126
@@ -457,7 +458,8 @@ PostgreSQL documentation
457458
458459 <para>
459460 <application>pg_receivewal</application> will exit with status 0 when
460- terminated by the <systemitem>SIGINT</systemitem> signal. (That is the
461+ terminated by the <systemitem>SIGINT</systemitem> or
462+ <systemitem>SIGTERM</systemitem> signal. (That is the
461463 normal way to end it. Hence it is not an error.) For fatal errors or
462464 other signals, the exit status will be nonzero.
463465 </para>
Original file line number Diff line number Diff line change @@ -46,6 +46,13 @@ PostgreSQL documentation
4646 a slot without consuming it, use
4747 <link linkend="functions-replication"><function>pg_logical_slot_peek_changes</function></link>.
4848 </para>
49+
50+ <para>
51+ In the absence of fatal errors, <application>pg_recvlogical</application>
52+ will run until terminated by the <systemitem>SIGINT</systemitem>
53+ (<keycombo action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>)
54+ or <systemitem>SIGTERM</systemitem> signal.
55+ </para>
4956 </refsect1>
5057
5158 <refsect1>
@@ -407,6 +414,17 @@ PostgreSQL documentation
407414 </para>
408415 </refsect1>
409416
417+ <refsect1>
418+ <title>Exit Status</title>
419+ <para>
420+ <application>pg_recvlogical</application> will exit with status 0 when
421+ terminated by the <systemitem>SIGINT</systemitem> or
422+ <systemitem>SIGTERM</systemitem> signal. (That is the
423+ normal way to end it. Hence it is not an error.) For fatal errors or
424+ other signals, the exit status will be nonzero.
425+ </para>
426+ </refsect1>
427+
410428 <refsect1>
411429 <title>Environment</title>
412430
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ static int verbose = 0;
4545static int compresslevel = 0 ;
4646static int noloop = 0 ;
4747static int standby_message_timeout = 10 * 1000 ; /* 10 sec = default */
48- static volatile bool time_to_stop = false;
48+ static volatile sig_atomic_t time_to_stop = false;
4949static bool do_create_slot = false;
5050static bool slot_exists_ok = false;
5151static bool do_drop_slot = false;
@@ -673,13 +673,13 @@ StreamLog(void)
673673}
674674
675675/*
676- * When sigint is called , just tell the system to exit at the next possible
677- * moment.
676+ * When SIGINT/SIGTERM are caught , just tell the system to exit at the next
677+ * possible moment.
678678 */
679679#ifndef WIN32
680680
681681static void
682- sigint_handler (int signum )
682+ sigexit_handler (int signum )
683683{
684684 time_to_stop = true;
685685}
@@ -905,7 +905,8 @@ main(int argc, char **argv)
905905 * if one is needed, in GetConnection.)
906906 */
907907#ifndef WIN32
908- pqsignal (SIGINT , sigint_handler );
908+ pqsignal (SIGINT , sigexit_handler );
909+ pqsignal (SIGTERM , sigexit_handler );
909910#endif
910911
911912 /*
Original file line number Diff line number Diff line change @@ -650,11 +650,11 @@ StreamLogicalLog(void)
650650#ifndef WIN32
651651
652652/*
653- * When sigint is called , just tell the system to exit at the next possible
654- * moment.
653+ * When SIGINT/SIGTERM are caught , just tell the system to exit at the next
654+ * possible moment.
655655 */
656656static void
657- sigint_handler (int signum )
657+ sigexit_handler (int signum )
658658{
659659 time_to_abort = true;
660660}
@@ -922,7 +922,8 @@ main(int argc, char **argv)
922922 * if one is needed, in GetConnection.)
923923 */
924924#ifndef WIN32
925- pqsignal (SIGINT , sigint_handler );
925+ pqsignal (SIGINT , sigexit_handler );
926+ pqsignal (SIGTERM , sigexit_handler );
926927 pqsignal (SIGHUP , sighup_handler );
927928#endif
928929
You can’t perform that action at this time.
0 commit comments