On Thu, Jun 2, 2016 at 6:54 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Fri, Jun 3, 2016 at 8:48 AM, David G. Johnston
> <david.g.johnston@gmail.com> wrote:
>> On Thu, Jun 2, 2016 at 7:39 PM, Michael Paquier <michael.paquier@gmail.com>
>> 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