Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqHcK-00061k-6l for pgsql-admin@arkaria.postgresql.org; Mon, 07 Jun 2021 15:56:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lqHcJ-0006wR-5B for pgsql-admin@arkaria.postgresql.org; Mon, 07 Jun 2021 15:56:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqHcI-0006wA-SK for pgsql-admin@lists.postgresql.org; Mon, 07 Jun 2021 15:56:42 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lqHcE-0007dA-Tq for pgsql-admin@lists.postgresql.org; Mon, 07 Jun 2021 15:56:41 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 94B405F799; Mon, 7 Jun 2021 11:56:34 -0400 (EDT) Date: Mon, 7 Jun 2021 11:56:34 -0400 From: Stephen Frost To: Ron Cc: pgsql-admin@lists.postgresql.org Subject: Re: Automate pg_basebackup in linux Message-ID: <20210607155634.GM20766@tamriel.snowman.net> References: <345839be-63ea-5a68-da74-4121cfddbf88@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PR4vecQPKQM4DM0B" Content-Disposition: inline In-Reply-To: <345839be-63ea-5a68-da74-4121cfddbf88@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --PR4vecQPKQM4DM0B Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Ron (ronljohnsonjr@gmail.com) wrote: > On 6/5/21 12:14 PM, SMAX Inbound wrote: > >is there any script to automate pg_basebackup in linux using cron job.. > >i.e. shell script that will automate taking basebackup weekly, and > >removing previous backup and wal files once base backup is successfully > >completed... > > >=20 > If you know any shell scripting languages, such a script is easy to write= =2E=A0 > (Are you saying that you don't know "shell"?) Writing a script that actually does everything correct is actually really hard, unfortunately. I know, I tried (and using perl too, not just unix shell...). Leveraging pg_basebackup makes it a bit easier as that'll do things like properly fsync'ing the files but it doesn't do anything for really managing WAL. Definitely strongly recommend using existing tools which have been developed for PostgreSQL and which handle expiration of backups and WAL. Thanks, Stephen --PR4vecQPKQM4DM0B Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJgvkGyAAoJEO1sijiDR2RVDNkQAJDX2i/yW9vYJPLGpgXRhUPN 9CKuw+Rb9hG1QPEcFu7lK7BXaBnNhBIcCkeqpWkdzfbRiCxo09XnNt6lf7fvL9jo TQzfSdac5kUXL6QA8aQ7w6McAi8QuApC/xLMFCxjMc/nu8lGVIBlEwuZZ9fIFWdV EoErmwZaknaghxN3JxIEL6eL2Xl4ZwaqF5CV2B9fqutSQd+Hr1KkHVFVG8LxWHZ+ mVGfi/6nXFNbX6Ugo4hr95AQ+npFJXEIqzmtLrYBdXcyilqwbVcHWMNxt2Sh7Ryr 1xWKrc15COvcvTzWhhFZptbCR7XFgB6fHEdVfgMvXnyC7TGeS9IX2dcXPZTa4Tef OLiBjU2TntddtVUhnxiu8m8powkd3TRX3vjFpRvwhfguWMIHk7ToVR+OzZMs5lMg thBU7zqcZ84h+9gVgnMb1Z82xzUTFfZuYWQ/IU49HwZBQB4rjG6vxB+meI5RpxXm KEyO5HNndXVDeVqmaoj/nrB8He3xbyiXl1gYIzaSAPunbvmkyLN6I5SoSBPsMiai JmrKzYdvEQXLORgvJernulop1Edbw2o7LBfb6dEZ+1D+1JE7YO1Hvj9bb6sPR8b6 0qf9NYJx/E0iZDr2qHwt2s81kHDeuGU+8nhp0KujQN6IquQ5QGYywh/hrjykqzvm 1HtrITaqC3lBaZWkKP/A =/3FZ -----END PGP SIGNATURE----- --PR4vecQPKQM4DM0B--