Re: Bash profile

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Bash profile
Date: 2025-02-15 19:14:43
Message-ID: CANzqJaACBCTmxejwZwEHPF-3Uee0eTA73f5hL5Z9PvWZR7we-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Feb 15, 2025 at 2:01 PM Yongye Serkfem <yserkfem(at)gmail(dot)com> wrote:

> Hi Everyone!
> I would appreciate any assistance with configuring the bash profile to run
> two different postgresql versions. Specifically V12.7 and 15.7
>

Create a bash function that exports PGDATA to the relevant directory, based
on the parameter you pass.
Add as much error checking (to ensure that the parameter you passed
actually points to a real data dir and that the postmaster is running. How
you do that depends on whether it's Debian-based, RH-based or something
else.

We, for example, have standardized on data directories in the format:
/Database/<MajorVer>/data

Thus, something as simple as this would work for us:
pgswitch() { export PGDATA=/Database/${1}/data ; }

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yongye Serkfem 2025-02-15 19:17:00 Re: Bash profile
Previous Message David G. Johnston 2025-02-15 19:13:44 Re: Bash profile