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 1v9Ohx-00HPUf-1r for pgsql-admin@arkaria.postgresql.org; Thu, 16 Oct 2025 14:11:56 +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 1v9Ohu-00DEwT-KS for pgsql-admin@arkaria.postgresql.org; Thu, 16 Oct 2025 14:11:53 +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 1v9Ohu-00DEwL-8h for pgsql-admin@lists.postgresql.org; Thu, 16 Oct 2025 14:11:53 +0000 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v9Ohr-002XJk-05 for pgsql-admin@lists.postgresql.org; Thu, 16 Oct 2025 14:11:52 +0000 Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-65043e595a8so370057eaf.0 for ; Thu, 16 Oct 2025 07:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760623908; x=1761228708; 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=XBXhL5OStyYxQT6SE3EfF6U9eJA0FpnHgdAztbOmvuw=; b=f8ikM2oE7sM9HlenOXr+c0ZXcpWSDRar2JGAky/nUBnFubVtfNhcxDB5mXP0aQSEvH nd8vSucKCUJDDlJdUoETcGKiqzPGj3Q3kHMF3ZBbDduHcJwXOeXKNUtnYRSg19yvpT7l LLcawWkAxt7kn+3Y2+Xg1tFSa0tPJdCFuWtKYkeYFvYRsK0/QSXLB10gDzj+DaJS1Fnu 6r/TmwWqYIa2B3rDYbx1+mi0x7Pn57J2W3V5Uajg24CEYXloQIjdthpgtamdE+r7hA5u jI4cOY9Ad+6IEqFScSk9tZlOYkhfdlycDz7KMs7sxgxh7HkQbP+euK/5pxJWWgt1EsIl xisQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760623908; x=1761228708; 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=XBXhL5OStyYxQT6SE3EfF6U9eJA0FpnHgdAztbOmvuw=; b=KFeE39F86V/vGQNSop7IzVSLR8mORFcbSHer1Coarle3iv0Eb/rE0bFdIXE6Y6ufgt tDiLaaDBVSCWUVwYeqLqZi6o5ECi9WqVufvfRaVB2gvgTvIn4dbJbnJMPGKWAB485LBt xZuGab1ZEszDitxI27JALJ6+I9c0Gu6tg3zKrJOme1+TSQgy+3t9K1Klt5JJaIQVL60x dR7asubLLoRt3EJDl7I6ZuhMP7gMxwKvnq3Gfmc3BD9Gz1yd9OcS8KAQic5wLRcPHDC1 8vE8t/rUMOa2DJZQjAlf/uaKHC2IKoN1WsFOj2g2QWHk4h3uS7cMvT++x7RDxekY6Ytm mqtw== X-Gm-Message-State: AOJu0YxY85tgDT0JHCxdnkw53vxj20/j4LybVfDe1FmzCtRdu7GeUMcR TJHLeqQYunTpDauuIEO58oUn3ytyM/1pPVfE6oYf5gIvFIWzbLAeQMR0Hz7SJEDK1ShTW9wjVtj 3BRdg3TVwfVwwV2ww722/nvGqfPOqNKd/7g== X-Gm-Gg: ASbGncv8Jzp8sBpZ+S42xBD2pdo+KJwKaaiuoZbYJOAS51xfeworSxzjhm4NqURFXyM 89Ez9arveBL/aPF77G6JXwKZWBwRMv9/fuA8kdKPYK5U1RaeLQtAjx7lMku6/moUV2aAnpqW+n9 Mgx96wlLYv0LuAZ1S0NJRa2mqaN+ARolEN7obQsgVPYZkeXGDLnj1KX5GqyrEl6IF9+88TtVod6 jWWxQoblnCqBTcYHQAFZFKw+WAEZSM7pO2b3hr7CnxAciXPk4mZP3sNG1/QFFfv1j0s9liy X-Google-Smtp-Source: AGHT+IFPwljhEnb5WL51ESUFBZDNwuRJQCQMQMDwekCCSzJfqcy6jZ1+LRzVf7MoLXveE7x+nNnwm3A8+eVXZRgqpOE= X-Received: by 2002:a05:6808:7006:b0:43f:1ae3:78f1 with SMTP id 5614622812f47-443a2f2a7famr56585b6e.20.1760623908389; Thu, 16 Oct 2025 07:11:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Thu, 16 Oct 2025 10:11:37 -0400 X-Gm-Features: AS18NWDbOyXHf4NBnLZlHQKF2Cjq74EraRir5HPmccC9pwJLhG21kr9EA_CNl4U Message-ID: Subject: Re: Looking for a linux tool to automate PG admin tasks To: pgsql-admin Content-Type: multipart/alternative; boundary="000000000000a4858e06414732de" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a4858e06414732de Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Oct 16, 2025 at 9:46=E2=80=AFAM hubert depesz lubaczewski 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 som= e > > 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. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000a4858e06414732de Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Oct 16, 2025 at 9:46=E2=80=AFAM h= ubert depesz lubaczewski <depesz@de= pesz.com> wrote:
On Thu, Oct 16, 2025 a= t 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 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!
--000000000000a4858e06414732de--