Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9btW-003Pqr-D4 for pgsql-admin@arkaria.postgresql.org; Fri, 17 Oct 2025 04:16:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v9btT-00H9G9-RG for pgsql-admin@arkaria.postgresql.org; Fri, 17 Oct 2025 04:16:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9btT-00H9Fy-Fy for pgsql-admin@lists.postgresql.org; Fri, 17 Oct 2025 04:16:42 +0000 Received: from mail-ua1-x935.google.com ([2607:f8b0:4864:20::935]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v9btQ-002eBK-0H for pgsql-admin@lists.postgresql.org; Fri, 17 Oct 2025 04:16:42 +0000 Received: by mail-ua1-x935.google.com with SMTP id a1e0cc1a2514c-932bf9df69dso4522241.1 for ; Thu, 16 Oct 2025 21:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760674598; x=1761279398; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=a93+x+KaQYGPgwt3MdWegTvv1QFER6VtcWEvpsyEZHw=; b=krPjVS5ooLXFd7fCwXTY7Z8ht5Qe7ctD+m4QYaor9pLVsw6LwncBC3HDReNaOcdpne e7S3PrIn5qjbMRphrAIUyTLB7qJWjGh2treRWWXzDeI8G3aq0EO8uxwzdYqBcyHPYRZS xhn5TszvzhsdaBVnDNzUAtxQW6lEjAld0PkEtkqcGiGKEsbbijNFSS0MCKB7A61a7K8S 9tS3dMUXy8GfR/Lm+JWZhukwRSi6qJEO9BKjsvNutgohvMH0NLWQZz0U3+nLH7c/3Bs/ AfwqVLEHChx3aLlm/h4jqwJ2B/3u3Z87PqvvNp4wwxZfJ2hhPH3qnSrQzQfpq1dBCo4s 6yPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760674598; x=1761279398; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=a93+x+KaQYGPgwt3MdWegTvv1QFER6VtcWEvpsyEZHw=; b=DePQ7agvz7TPAx/Kg0hGYXquqtp+odl3czh+tNopIYhV4VgKrCzKud+fqayHYUyeaV QN59YfcjMy2+UPxNiNKDMWsR+17lN4gkq38LiyPgvHuJnHo85xvAdvOFC/urWTCU1+qi ZJ1YbcbHxhO1JK+9R+/MH3dVhDVQUL7ZuwBTVlZngwIvrWSw7iPgvDV2sOQZdMTAWtCz VmstbIM6ws6CoYXy5RT5lw0dwFAAmFsVOK+YXsuDos2M3yyQMUEw+gIiFLrF4LuyOs0R lRzgDrabBbb7j89qQxdpYr8iohZxTvOIO2IpRMvfwQ8bXIpkJkORoS/124vItwshaOIr 8sAA== X-Gm-Message-State: AOJu0Yy7GuTOMvW8qL7k29nV0SxpQo9OJL8J/sZwl372Bxfmi76ajgBg CQR28Ja39utg7lCo2RyCAnru8jLpCnkt9IXQBs/3M3FiKMW7OHwZcOo9QOmnh/3EzGSs1SCyR4C RoSnta7olGThi4nB8ohGZ5/Jw3pmA+Abmwg== X-Gm-Gg: ASbGncvwMjfJsBvtG9B+lHOSL1aekB+ZvugjW/Dmvlv/+ugkCL4tHPRjI8D4OL5Z+KO as8mc06IJ6ve2YTDsKeZ8+XdXPXfgivJX/8iPYacqA4LDq6aU7wwRLglQL2mcgqaqehytQ49Ayk FfPg1GKeHxtEkQzCRfuU8Q7x+QFzfemXYASag1TtYHpn4ZJeBLJ/g434eTNaVMqFl5QOK2Iw0f0 5WAIjXSPsXi7dMqyLzb9lae3d/YsNhiOcREwI34yvdzeHyG/veGiR040bFC X-Google-Smtp-Source: AGHT+IE04be6ReDMAKSEbCM3Una6GpZvaOvdLi8PysQeHdWMQcRe4HGOqAMbVAOZpFbw/h27vnIhUJ6wYuFd9whbUdw= X-Received: by 2002:a05:6102:358a:b0:5d6:1309:8a4f with SMTP id ada2fe7eead31-5d7dd6fb1c4mr1039935137.39.1760674598041; Thu, 16 Oct 2025 21:16:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Roland_M=C3=BCller?= Date: Fri, 17 Oct 2025 07:16:24 +0300 X-Gm-Features: AS18NWB8posIZajpvE6kXmgdPrwIeBCtCWgCcqJ5oUtEbX-1KXSeNh-aGKUBLLY Message-ID: Subject: Re: Looking for a linux tool to automate PG admin tasks To: pgsql-admin Content-Type: multipart/alternative; boundary="000000000000fb3db7064152ffcf" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000fb3db7064152ffcf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable May be Ansible? There is a dedicated module for Postgresql and a lot of modules for general tasks such as installation etc. https://docs.ansible.com/ansible/latest/collections/community/postgresql/in= dex.html Br Roland Ron Johnson ezt =C3=ADrta (id=C5=91pont: 2025. ok= t. 16., Cs 17:12): > On Thu, Oct 16, 2025 at 9:46=E2=80=AFAM hubert depesz lubaczewski < > depesz@depesz.com> wrote: > >> On Thu, Oct 16, 2025 at 03:17:16PM +0200, Jean-Christophe Boggio wrote: >> > Hello, >> > I have several servers with many databases on them for different >> > applications. >> > I need to execute some tasks on some databases depending on some >> criteria. >> > For example, execute query xxx but only on databases where table >> > public.sometable exists or if number of rows in table yyy is > 1M. >> > Before reinventing the wheel with ugly bash scripts, do you know of so= me >> > tools that would suit my case ? >> > Some tasks will have to execute periodically (with crons probably) and >> > others will be one-off. >> > CLI tools if possible because I'm working remotely on those servers of >> > course. >> >> Well, I'd just use psql, with some simple script using \gexec >> functionality. Solves virtually any problem of this kind. >> > > Ditto. bash scripts are only ugly if you write ugly bash. > > -- > Death to , and butter sauce. > Don't boil me, I'm still alive. > lobster! > --000000000000fb3db7064152ffcf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
May be Ansible? There is a dedicated module for Postgresq= l and a lot of modules for general tasks such as installation etc. https://docs.ansible.com/ansible/latest/collections/community= /postgresql/index.html

Br<= /div>
Roland=C2=A0

Ron Johnson = <ronljohnsonjr@gmail.com&= gt; ezt =C3=ADrta (id=C5=91pont: 2025. okt. 16., Cs 17:12):
On Thu, Oct 16, 2025 at 9:46=E2=80=AFAM hubert depesz lubaczewski <dep= esz@depesz.com> wrote:
On Thu, Oct 16, 2025 at 03:17:16PM +02= 00, Jean-Christophe Boggio wrote:
> Hello,
> I have several servers with many databases on them for different
> applications.
> I need to execute some tasks on some databases depending on some crite= ria.
> For example, execute query xxx but only on databases where table
> public.sometable exists or if number of rows in table yyy is > 1M.<= br> > Before reinventing the wheel with ugly bash scripts, do you know of so= me
> tools that would suit my case ?
> Some tasks will have to execute periodically (with crons probably) and=
> others will be one-off.
> CLI tools if possible because I'm working remotely on those server= s of
> course.

Well, I'd just use psql, with some simple script using \gexec
functionality. Solves virtually any problem of this kind.
<= div>

Ditto.=C2=A0 bash scripts are only ugly= if you write ugly bash.

--
Death to <Redacted>, and butter sauce.
Don't boil me= , I'm still alive.
<Redacted> lobster!
--000000000000fb3db7064152ffcf--