Re: psql remote shell command

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: psql remote shell command
Дата
Msg-id 20160602235450.GX21416@tamriel.snowman.net
обсуждение исходный текст
Ответ на psql remote shell command  (Dennis <dennisr@visi.com>)
Ответы Re: psql remote shell command  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
* Dennis (dennisr@visi.com) wrote:
> Is it possible to execute command in on system the is hosting postgresql remotely using psql or other mechanism?  I
knowI can use \! in psql but that executes the commands on the host where I am running psql from.  Also, is it possible
fora postgres login/user to stop or restart a running postgres instance from in side psql or similar client. e.g. psql
-c“pg_ctl stop -D some_data_dir” 

You can use COPY with PROGRAM, assuming you're a superuser.

COPY (select 1) TO PROGRAM 'whatever command';

You could use that to issue a pg_ctl stop, though you'll then lose your
connection to the database.

You can 'reload' the running configuration by using:

select pg_reload_conf();

Not all parameters can be changed while PG is running, but most of them
can be.  Parameters in postgresql.conf can be updated via ALTER SYSTEM
through psql also.

Issuing a 'pg_ctl restart' via COPY PROGRAM isn't a good idea and may
not work, though I suppose you could try if you really wish to.

Thanks!

Stephen

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Slave claims requested WAL segment already removed - but it wasn't
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: psql remote shell command