Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ita7n-0004yG-AL for pgsql-general@arkaria.postgresql.org; Mon, 20 Jan 2020 16:42:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ita7l-00070P-MW for pgsql-general@arkaria.postgresql.org; Mon, 20 Jan 2020 16:42:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ita7l-00070I-96 for pgsql-general@lists.postgresql.org; Mon, 20 Jan 2020 16:42:01 +0000 Received: from mail-oi1-x241.google.com ([2607:f8b0:4864:20::241]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ita7e-00007j-Ro for pgsql-general@lists.postgresql.org; Mon, 20 Jan 2020 16:42:00 +0000 Received: by mail-oi1-x241.google.com with SMTP id l9so29010054oii.5 for ; Mon, 20 Jan 2020 08:41:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=wIaqURHM8V2nIf7rzIMTBswMUJGY8K9KKLOYCmo+dYo=; b=lFz67DJWsrYplnG/vdwFFXlA5jRXhn6UM5AbSZ+oVtx20dd38aG5nBpHTeeNHb1G/v Q36EXSrHruOEYk/b+Pjn/hKCkP2mcemRRgOGgAslXGlpOjatTfCPNzKmm3yzS1LpRaga X3vjkXH6sMwa0s3oq7qiTr2xQ0hUqwh3dCdhHiz2AdBNdAwsVA4fIMIcnsvw4z8PVJmC W8AE5gl20UtKlBvpajJjlc8VT8KCmPIMlAtRgV87AlzIbMCnREY8x+NfeZa513Q2Fz1G pLGz8ZuMNZzHY7SdukD8uR3HVLz+3HYsqilorNCFJbN0cwqFP8kiXSxuYYokr79ajo40 knvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=wIaqURHM8V2nIf7rzIMTBswMUJGY8K9KKLOYCmo+dYo=; b=PmNmWZvxHz6skBvGqeFm/kaj46ag7af5FnReHFKxP4FQ//cSda1tYvYhOX2P00kaP1 Sk3kRq6ejP1INfcPnuTt7IgbaErK2uWamK2P7SEPwqwGevDJ/i1HcG7o8KRTJqV5m9Al hw5CRSMqV///mOs157GP77Zr44QZpkm7MZXoJ/XX9gRpvnB7bkmfdW6xPtyUK8ERFSRf WH66Mto2xmxBT0pBFMjmGq7enQ9tq9ACZ/yx0/TcY476oYg3/T2k6hk66eCxN1r71be3 uALA8xt/yGcbaAkfepvGB0iZD9URtGbK/LF8UcT7Zbd9F8GEdPc1eiBjJb7jTMY0IF8A fczw== X-Gm-Message-State: APjAAAUkbWaszj1Otw2h0j/rpQdA+CWU1QYwojuLoipsq4U6RHDIBhQd ghQPcHuSgICbJGqwogwrxDAXpP1uaFc= X-Google-Smtp-Source: APXvYqzzzp4KT20keP80ysyZnTdpWBQefkcyiwxsH+JDthB7ZOOIYTkb2hr4AT8krf1DQA9K57HoOw== X-Received: by 2002:aca:45c1:: with SMTP id s184mr131509oia.158.1579538512385; Mon, 20 Jan 2020 08:41:52 -0800 (PST) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id h9sm11026756oie.53.2020.01.20.08.41.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jan 2020 08:41:51 -0800 (PST) Subject: Re: postgresql commands(psql,createdb,dropdb) are not working from shell script To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <57e93a09-6ca5-5b6f-2f26-1c42cbd8e575@gmail.com> Date: Mon, 20 Jan 2020 10:41:51 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------5FCAF1CBCAF54A5832059CF5" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------5FCAF1CBCAF54A5832059CF5 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Where is JENKINS installed, and where is Postgres installed?  Are they on the same server? On 1/20/20 12:00 AM, Ramesh Penuballi wrote: > Hi Ron, > > I have checked on my Jenkins server.bashrc and. bashprofiles filed of root > and Jenkins users but  didn't find anything about postgresql path. It > might be the reason that Jenkins and Postgresql services are running in > two separate Linux  instances. > > From the  Linux server  where JENKINS installed, the job is running > successfully to take the backup of our production  server where postgresql > is running on the separate RHEL7 instance after running psql, and pg_dump > commands. > > But the issue is that the jenkins  job is failing when we tried to perform > the restore activity from prod to stage environments. > > Do you have any idea where to check the locations where postgresql path in > Linux to compare the same prod and stage environments. > > Thanks and Regards > Ramesh Penuballi > > > > On Fri, 17 Jan, 2020, 18:52 Ramesh Penuballi, > wrote: > > Thanks once again for sharing the info. > Let me check and get back to you. > > Thanks and Regards > Ramesh Penuballi > > On Fri, 17 Jan, 2020, 18:43 Ron, > wrote: > > The Jenkins server needs to be able to find the Unix executables > dropdb, createdb and psql. > > I don't know *anything* about Jenkins, or even whether or not > Jenkins runs on the same box as Postgres, but there's *some* shell > script *somewhere* that points $PATH to the proper Postgres binaries. > > On 1/17/20 6:56 AM, Ramesh Penuballi wrote: >> Dear Ron, >> >> Thanks for looking into this query. >> >> Could you please let me know how can I check the same. >> >> We are able take our production backup  from the  Jenkins server, >> and the issue is with our uat database server only. >> >> Could you please let me know how to check the path on Jenkins >> server as I am new to Jenkins. >> >> Thanks and Regards >> Ramesh Penuballi >> >> On Fri, 17 Jan, 2020, 17:53 Ron, > > wrote: >> >> Does the Jenkins' $PATH variable have the Postgres binaries' >> location? >> >> On 1/17/20 2:47 AM, ramesh penumalli wrote: >>> Dear Team, >>> >>> I am using postgresql 9.2.12 version and I am facing  an >>> issue while running the executing the >>> commands createdb,dropdb,psql commands in the shell script >>> which is running from Jenkins to restore prod data into >>> stage environment. >>> >>> Jenkins job is failing with the below output.I have verified >>> the script and the scrit is fine and it seems to be an issue >>> with the configuration of postgresql  and not sure where to >>> make the changes. >>> >>> line 48: dropdb: command not found >>> line 50: createdb: command not found >>> line 52: psql: command not found >>> Kindly guide me to rectify the issue. >>> Thanks and Regards, >>> Ramesh >> >> -- >> Angular momentum makes the world go 'round. >> > > -- > Angular momentum makes the world go 'round. > -- Angular momentum makes the world go 'round. --------------5FCAF1CBCAF54A5832059CF5 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Where is JENKINS installed, and where is Postgres installed?  Are they on the same server?

On 1/20/20 12:00 AM, Ramesh Penuballi wrote:
Hi Ron,

I have checked on my Jenkins server.bashrc and. bashprofiles filed of root and Jenkins users but  didn't find anything about postgresql path. It might be the reason that Jenkins and Postgresql services are running in two separate Linux  instances.

From the  Linux server  where JENKINS installed, the job is running successfully to take the backup of our production  server where postgresql is running on the separate RHEL7 instance after running psql, and pg_dump commands. 

But the issue is that the jenkins  job is failing when we tried to perform the restore activity from prod to stage environments.

Do you have any idea where to check the locations where postgresql path in Linux to compare the same prod and stage environments. 

Thanks and Regards 
Ramesh Penuballi 



On Fri, 17 Jan, 2020, 18:52 Ramesh Penuballi, <ramesh.252@gmail.com> wrote:
Thanks once again for sharing the info.
Let me check and get back to you.

Thanks and Regards 
Ramesh Penuballi 

On Fri, 17 Jan, 2020, 18:43 Ron, <ronljohnsonjr@gmail.com> wrote:
The Jenkins server needs to be able to find the Unix executables dropdb, createdb and psql.

I don't know anything about Jenkins, or even whether or not Jenkins runs on the same box as Postgres, but there's some shell script somewhere that points $PATH to the proper Postgres binaries.

On 1/17/20 6:56 AM, Ramesh Penuballi wrote:
Dear Ron, 

Thanks for looking into this query. 

Could you please let me know how can I check the same. 

We are able take our production backup  from the  Jenkins server, and the issue is with our uat database server only. 

Could you please let me know how to check the path on Jenkins server as I am new to Jenkins. 

Thanks and Regards 
Ramesh Penuballi 

On Fri, 17 Jan, 2020, 17:53 Ron, <ronljohnsonjr@gmail.com> wrote:
Does the Jenkins' $PATH variable have the Postgres binaries' location?

On 1/17/20 2:47 AM, ramesh penumalli wrote:
Dear Team,

I am using postgresql 9.2.12 version and I am facing  an issue while running the executing the commands createdb,dropdb,psql commands in the shell script which is running from Jenkins to restore prod data into stage environment.

Jenkins job is failing with the below output.I have verified the script and the scrit is fine and it seems to be an issue with the configuration of postgresql  and not sure where to make the changes.

line 48: dropdb: command not found
line 50: createdb: command not found
line 52: psql: command not found
Kindly guide me to rectify the issue.
Thanks and Regards,
Ramesh

--
Angular momentum makes the world go 'round.

--
Angular momentum makes the world go 'round.

--
Angular momentum makes the world go 'round.
--------------5FCAF1CBCAF54A5832059CF5--