pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedusing pg_ctl over ssh hangs
4+ messages / 4 participants
[nested] [flat]
* using pg_ctl over ssh hangs
@ 2023-10-20 01:24 Sbob <sbob@quadratum-braccas.com>
0 siblings, 3 replies; 4+ messages in thread
From: Sbob @ 2023-10-20 01:24 UTC (permalink / raw)
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: using pg_ctl over ssh hangs
@ 2023-10-20 01:31 David G. Johnston <david.g.johnston@gmail.com>
parent: Sbob <sbob@quadratum-braccas.com>
2 siblings, 0 replies; 4+ messages in thread
From: David G. Johnston @ 2023-10-20 01:31 UTC (permalink / raw)
To: Sbob <sbob@quadratum-braccas.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
On Thursday, October 19, 2023, Sbob <sbob@quadratum-braccas.com> wrote:
>
> $ 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
>
>
This has nothing to do with ssh. The start command is behaving as
documented. Read the documentation for it to understand why, and what your
options are.
David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: using pg_ctl over ssh hangs
@ 2023-10-20 01:32 Tom Lane <tgl@sss.pgh.pa.us>
parent: Sbob <sbob@quadratum-braccas.com>
2 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2023-10-20 01:32 UTC (permalink / raw)
To: Sbob <sbob@quadratum-braccas.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Sbob <sbob@quadratum-braccas.com> writes:
> 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
> $ ssh -T postgres@${node3} "/usr/pgsql-14/bin/pg_ctl -D
> /var/lib/pgsql/14/data start"
If you don't specify a log file (-l option to pg_ctl) then the
postmaster's stdout doesn't get dissociated from the calling terminal,
which likely explains why ssh doesn't think the session is done.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: using pg_ctl over ssh hangs
@ 2023-10-20 13:55 vrms <vrms@netcologne.de>
parent: Sbob <sbob@quadratum-braccas.com>
2 siblings, 0 replies; 4+ messages in thread
From: vrms @ 2023-10-20 13:55 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org
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
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2023-10-20 13:55 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20 01:24 using pg_ctl over ssh hangs Sbob <sbob@quadratum-braccas.com>
2023-10-20 01:31 ` David G. Johnston <david.g.johnston@gmail.com>
2023-10-20 01:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-10-20 13:55 ` vrms <vrms@netcologne.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox