Re: BUG #4435: pg_ctl start doesn't detach when run via SSH

Lists: pgsql-bugs
From: "Hal Black" <black(at)ieee(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4435: pg_ctl start doesn't detach when run via SSH
Date: 2008-09-23 17:30:24
Message-ID: 200809231730.m8NHUOko051058@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4435
Logged by: Hal Black
Email address: black(at)ieee(dot)org
PostgreSQL version: 8.3.3
Operating system: Ubuntu Hardy 8.04.1 LTS
Description: pg_ctl start doesn't detach when run via SSH
Details:

When I run "pg_ctl start" via SSH, the database service starts, but it never
returns control to the shell. If I run the same command from an interactive
shell, it works as expected.

This is with or without the -w option. Here's an example commandline.

ssh root(at)example(dot)com "su -c '/home/appuser/local/bin/pg_ctl start -w -s -D
/home/appuser/postgresql_data' postgres"

This problem exists both when installed from source and when using the
postgresql installed via the debian package manager (of course using a
different path to the pg_ctl binary)


From: Steve Clark <sclark(at)netwolves(dot)com>
To: Hal Black <black(at)ieee(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4435: pg_ctl start doesn't detach when run via SSH
Date: 2008-09-23 17:54:07
Message-ID: 48D92D3F.9030405@netwolves.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hal Black wrote:
> The following bug has been logged online:
>
> Bug reference: 4435
> Logged by: Hal Black
> Email address: black(at)ieee(dot)org
> PostgreSQL version: 8.3.3
> Operating system: Ubuntu Hardy 8.04.1 LTS
> Description: pg_ctl start doesn't detach when run via SSH
> Details:
>
> When I run "pg_ctl start" via SSH, the database service starts, but it never
> returns control to the shell. If I run the same command from an interactive
> shell, it works as expected.
>
> This is with or without the -w option. Here's an example commandline.
>
> ssh root(at)example(dot)com "su -c '/home/appuser/local/bin/pg_ctl start -w -s -D
> /home/appuser/postgresql_data' postgres"
>
> This problem exists both when installed from source and when using the
> postgresql installed via the debian package manager (of course using a
> different path to the pg_ctl binary)
>
try using ssh -t ...


From: "Hal Black" <black(at)ieee(dot)org>
To: "Steve Clark" <sclark(at)netwolves(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4435: pg_ctl start doesn't detach when run via SSH
Date: 2008-09-23 19:33:36
Message-ID: 961375d50809231233s7c9274ads241e3c905ed7d709@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

That works, but interestingly, I still get a SIGHUP reload sometimes:
LOG: received SIGHUP, reloading configuration files

On Tue, Sep 23, 2008 at 1:54 PM, Steve Clark <sclark(at)netwolves(dot)com> wrote:

> Hal Black wrote:
>
>> The following bug has been logged online:
>>
>> Bug reference: 4435
>> Logged by: Hal Black
>> Email address: black(at)ieee(dot)org
>> PostgreSQL version: 8.3.3
>> Operating system: Ubuntu Hardy 8.04.1 LTS
>> Description: pg_ctl start doesn't detach when run via SSH
>> Details:
>> When I run "pg_ctl start" via SSH, the database service starts, but it
>> never
>> returns control to the shell. If I run the same command from an
>> interactive
>> shell, it works as expected.
>>
>> This is with or without the -w option. Here's an example commandline.
>>
>> ssh root(at)example(dot)com "su -c '/home/appuser/local/bin/pg_ctl start -w -s
>> -D
>> /home/appuser/postgresql_data' postgres"
>>
>> This problem exists both when installed from source and when using the
>> postgresql installed via the debian package manager (of course using a
>> different path to the pg_ctl binary)
>>
>> try using ssh -t ...
>
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Clark <sclark(at)netwolves(dot)com>
Cc: Hal Black <black(at)ieee(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4435: pg_ctl start doesn't detach when run via SSH
Date: 2008-09-24 03:16:44
Message-ID: 17905.1222226204@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Steve Clark <sclark(at)netwolves(dot)com> writes:
> Hal Black wrote:
>> When I run "pg_ctl start" via SSH, the database service starts, but it never
>> returns control to the shell. If I run the same command from an interactive
>> shell, it works as expected.
>>
>> This is with or without the -w option. Here's an example commandline.
>>
>> ssh root(at)example(dot)com "su -c '/home/appuser/local/bin/pg_ctl start -w -s -D
>> /home/appuser/postgresql_data' postgres"

> try using ssh -t ...

Actually I suspect the main problem is having failed to redirect the
postmaster's stdout/stderr away from the terminal. Consider using
pg_ctl's "-l logfile" option.

Another point is that su's -l option might be a good idea. I'm
unconvinced that you're setting up a desirable environment for the
postmaster here --- it's going to be mostly root's environment.

regards, tom lane