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 1v9OJB-00HJDe-N3 for pgsql-admin@arkaria.postgresql.org; Thu, 16 Oct 2025 13:46:21 +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 1v9OJA-00D6EP-77 for pgsql-admin@arkaria.postgresql.org; Thu, 16 Oct 2025 13:46:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9OJ9-00D6EG-RL for pgsql-admin@lists.postgresql.org; Thu, 16 Oct 2025 13:46:18 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v9OJ6-0026PX-1V for pgsql-admin@lists.postgresql.org; Thu, 16 Oct 2025 13:46:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description; bh=pJuVA7pCnW4+DcrxxtRTfIKvc6fA9QOE7TC765mPtYs=; b=bZV9/VNNGtzklyDpY7clT2hSoo PJcXDPFmGR1H4hDx4eD79ztrWQqQG2v0s0gi+cKzTUu1jetv6aKz/4ixEtWWrhrdf0Q1YG688I3Dk j0BLw3Ejt32a+mnffSlOzSWxfq3NeyLiniKS+UoPwjAZDrw9dyeqn/R4SbW6zm57XaWc=; Received: from depesz by depesz.com with local (Exim 4.96) (envelope-from ) id 1v9OJ3-00EpUm-0p; Thu, 16 Oct 2025 15:46:13 +0200 Date: Thu, 16 Oct 2025 15:46:13 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Jean-Christophe Boggio Cc: pgsql-admin Subject: Re: Looking for a linux tool to automate PG admin tasks Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 some > 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. Best regards, depesz