DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Write-Ahead Log / Archive Recovery

recovery_end_command

Sets the shell command that will be executed once at the end of recovery.

  • Default: '' (empty)
  • Type: string
  • Applies: Reload

In plain words

A hook that runs once at the very end of recovery, for example after a point-in-time restore finishes or a standby is promoted. It is typically used for cleanup or to notify something. A failure is logged as a warning; the server still opens.

For DBAs and operators

Runs after replay has finished and before the server starts accepting normal connections (the end-of-recovery checkpoint and timeline switch happen around it). %r is replaced by the last file containing the latest valid restart point. Non-zero exit: a warning is logged and startup continues; termination by a signal aborts startup.

Examples: remove a temporary WAL staging directory, call a monitoring webhook, or tell a cluster manager that promotion completed. Not run after plain crash recovery (no recovery.signal or standby.signal).

How to change it

Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().

See it in context

Archiving and point-in-time recovery Startup process

Related parameters

restore_command archive_cleanup_command recovery_target_action

All Write-Ahead Log parameters