Search Postgresql Archives

Re: psql remote shell command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 2, 2016 at 6:54 PM, Michael Paquier
<michael.paquier@xxxxxxxxx> wrote:
> On Fri, Jun 3, 2016 at 8:48 AM, David G. Johnston
> <david.g.johnston@xxxxxxxxx> wrote:
>> On Thu, Jun 2, 2016 at 7:39 PM, Michael Paquier <michael.paquier@xxxxxxxxx>
>> wrote:
>> I was focused on admin task due to the pg_ctl (not sure you'd want to run
>> that via psql...) but if you have shell script applications you want to run
>> you could consider:
>>
>> https://github.com/petere/plsh
>
> This one is interesting...

CREATE OR REPLACE FUNCTION shexec(_cmd TEXT) RETURNS TEXT AS
$$#!/bin/bash

eval $1

$$ LANGUAGE plsh;

cds2=# select shexec('df -h');
                           shexec
────────────────────────────────────────────────────────────
 Filesystem            Size  Used Avail Use% Mounted on    ↵
 /dev/mapper/vg_root-lv_root                               ↵
                        20G  5.1G   14G  28% /             ↵
 tmpfs                 1.9G     0  1.9G   0% /dev/shm      ↵
 /dev/sda1             190M   83M   98M  47% /boot         ↵
 /dev/mapper/vg_db-lv_db                                   ↵
                       246G  161G   74G  69% /var/lib/pgsql↵
 rcdmpsfsnfs001.realpage.com:/exports/ybai                 ↵

:-)

merlin


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux