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 Stephen Frost <sfrost@snowman.net>
Re: psql remote shell command "David G. Johnston" <david.g.johnston@gmail.com>
Re: psql remote shell command Michael Paquier <michael.paquier@gmail.com>
Re: psql remote shell command "David G. Johnston" <david.g.johnston@gmail.com>
Re: psql remote shell command Michael Paquier <michael.paquier@gmail.com>
Re: psql remote shell command Merlin Moncure <mmoncure@gmail.com>
Re: psql remote shell command "David G. Johnston" <david.g.johnston@gmail.com>
Re: psql remote shell command Stephen Frost <sfrost@snowman.net>
Re: psql remote shell command John R Pierce <pierce@hogranch.com>
Re: psql remote shell command Dennis <dennisr@visi.com>
* 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 know I can use \! in psql but that executes the commands on the host where I am running psql from.  Also, is it possible for a 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
Дата:
От: Stephen Frost
Дата:
Сообщение: Re: psql remote shell command
FAQ