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 1qtpyQ-00E8ob-Dv for pgsql-admin@arkaria.postgresql.org; Fri, 20 Oct 2023 13:55:34 +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 1qtpyO-002Aiv-CS for pgsql-admin@arkaria.postgresql.org; Fri, 20 Oct 2023 13:55:33 +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 1qtpyN-002Aeo-U8 for pgsql-admin@lists.postgresql.org; Fri, 20 Oct 2023 13:55:32 +0000 Received: from cc-smtpout3.netcologne.de ([89.1.8.213]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qtpyK-001R9D-Sw for pgsql-admin@lists.postgresql.org; Fri, 20 Oct 2023 13:55:31 +0000 Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id 7C28A124D9 for ; Fri, 20 Oct 2023 15:55:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1697810124; bh=xRm2G4lo5XmuuoN1k4BF/mejtlymSUVG1IA962s1ZiE=; h=Message-ID:Date:Subject:To:References:From:In-Reply-To:From; b=g2NIApxPAI+iWYHvlIT77ikBUmQuKSwPTFlaXf3BBU6OYVBAAzEno/GGt6WuVgbrx e3ReB0Ftw2/nkxE6OtZeUHqY9975EubnJArvYxWP0y5Cfda3/gQWnDmAf1dTUK3QGB K0kjqFJW2AifuIhD9xjfYpf6KGyMmpj9H5oe9HTkIOoVkeIThZ8VTmmCvRC6j+zDH5 CkmNc6YICmagzkrCH1onwiWPcv+5nzHWgqwWVWNZbCJ/YQXYX6v+Z6cChiNVYyHM7M B2gHviBmH0La4nAZNjAoHgd4Aqjl+G9NM3+V/Dte0lFVqWhvY34wbi+2yBHtmA6Tm+ 8mkzeyDu2nM2g== Received: from [IPV6:2003:ce:df3f:f00:d360:f498:5999:6c79] (p200300cedf3f0f00d360f49859996c79.dip0.t-ipconnect.de [IPv6:2003:ce:df3f:f00:d360:f498:5999:6c79]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA id 3A88911E9E for ; Fri, 20 Oct 2023 15:55:23 +0200 (CEST) Content-Type: multipart/alternative; boundary="------------wLbMObB7W5STML9H4vNijb0o" Message-ID: <9cec4fa8-3f98-4fa5-b12e-85441a8e3326@netcologne.de> Date: Fri, 20 Oct 2023 15:55:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: using pg_ctl over ssh hangs To: pgsql-admin@lists.postgresql.org References: Content-Language: en-US From: vrms In-Reply-To: X-NetCologne-Spam: L X-Spamd-Bar: - X-Rspamd-Queue-Id: 3A88911E9E X-Rspamd-Action: no action List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------wLbMObB7W5STML9H4vNijb0o Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit even though this may not be 100% what you where asking for ... the first thing that comes to mind would be trying to send the remote command into the background     $ ssh -T postgres@${node3} "/usr/pgsql-14/bin/pg_ctl -D /var/lib/pgsql/14/data start &" this may come with the disadvantage that you do not receive the "server started"feedback. the second was to try Ansible - name: start postgres @ node 3   hosts: node3   tasks:   - name: start postgresql     ansible.builtin.cmd       cmd: "/usr/pgsql-14/bin/pg_ctl -D /var/lib/pgsql/14/data start"     become: true     become_user: postgres this of course requires for you to have Ansible available (which may come handy anyway). On 20.10.23 03:24, Sbob wrote: > > All > > > I am wanting to run pg_ctl as a command over ssh, however when I pass > start it hangs until I do a Ctl-C > > > This works fine: > > $ node3=172.16.171.132 > $ ssh -T postgres@${node3} "/usr/pgsql-14/bin/pg_ctl -D > /var/lib/pgsql/14/data stop" > waiting for server to shut down.... done > server stopped > $ > > I am immediately returned to a command prompt > > However , this does not return me to a command prompt until I do a Ctl-C: > > > $ node3=172.16.171.132 > > > $ ssh -T postgres@${node3} "/usr/pgsql-14/bin/pg_ctl -D > /var/lib/pgsql/14/data start" > waiting for server to start....2023-10-19 19:23:42.947 MDT [2053] LOG: >  redirecting log output to logging collector process > 2023-10-19 19:23:42.947 MDT [2053] HINT:  Future log output will > appear in directory "log". > done > server started > > ^C > $ > > > > Thanks in advance > > --------------wLbMObB7W5STML9H4vNijb0o Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit even though this may not be 100% what you where asking for ...

the first thing that comes to mind would be trying to send the remote command into the background

    $ ssh -T postgres@${node3} "/usr/pgsql-14/bin/pg_ctl -D /var/lib/pgsql/14/data start &"

this may come with the disadvantage that you do not receive the "server started" feedback.

the second was to try Ansible

- name: start postgres @ node 3
  hosts: node3
  tasks:

  - name: start postgresql
    ansible.builtin.cmd
      cmd: "
/usr/pgsql-14/bin/pg_ctl -D /var/lib/pgsql/14/data start"
    become: true
    become_user: postgres  


this of course requires for you to have Ansible available (which may come handy anyway).



On 20.10.23 03:24, Sbob wrote:

All


I am wanting to run pg_ctl as a command over ssh, however when I pass start it hangs until I do a Ctl-C


This works fine:

$ node3=172.16.171.132
$ ssh -T postgres@${node3} "/usr/pgsql-14/bin/pg_ctl -D /var/lib/pgsql/14/data stop"
waiting for server to shut down.... done
server stopped
$

I am immediately returned to a command prompt

However , this does not return me to a command prompt until I do a Ctl-C:


$ node3=172.16.171.132


$ ssh -T postgres@${node3} "/usr/pgsql-14/bin/pg_ctl -D /var/lib/pgsql/14/data start"
waiting for server to start....2023-10-19 19:23:42.947 MDT [2053] LOG:  redirecting log output to logging collector process
2023-10-19 19:23:42.947 MDT [2053] HINT:  Future log output will appear in directory "log".
done
server started

^C
$



Thanks in advance


--------------wLbMObB7W5STML9H4vNijb0o--