Re: psql remote shell command

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Dennis <dennisr(at)visi(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql remote shell command
Date: 2016-06-03 15:34:36
Message-ID: CAHyXU0yFK-KgXEpBG4cfvttYWfsLZvioN5Um3vGuXP7b+3Qtgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Leonardo M. Ramé 2016-06-03 15:42:06 pgFoundry down
Previous Message David G. Johnston 2016-06-03 12:05:39 Re: [pg_trgm] Making similarity(?, ?) < ? use an index