Re: How to run commands as Oracle linux user in Jenkins

From: kunwar singh <krishsingh.111_at_gmail.com>
Date: Tue, 19 May 2020 09:29:18 -0400
Message-ID: <CAJSrDUoLsq8BX9-kEKEitq6BU76Ha-gXw7LDXFz3r60GWKdohA_at_mail.gmail.com>



Thanks all , i found this blog which got me exactly what i was looking for. sorry if i asked the wrong question in initial post :)

http://blog.bjwallen.com/2015/09/build-automation-and-continuous_1.html

i.e.

Change the user that Jenkins runs as.

vi /etc/sysconfig/jenkins

JENKINS_USER="oracle"

Change ownership of jenkins home, webroot, and logs.

chown -R oracle:oinstall /var/lib/jenkins
chown -R oracle:oinstall /var/cache/jenkins
chown -R oracle:oinstall /var/log/jenkins

On Mon, May 18, 2020 at 7:22 PM William Beldman <wbeldma_at_uwo.ca> wrote:

> You might be able to insert a sudo in the script but you would probably
> need to configure passwordless sudo.
>
>
>
> Alternatively, you can do what we do which is a direct login:
>
> Configure the node to “Launch slave agents via SSH” and set the
> credentials on the node for the oracle user.
>
> Then when you write a job, you configure it to run on that node.
>
>
>
> *From:* oracle-l-bounce_at_freelists.org <oracle-l-bounce_at_freelists.org> *On
> Behalf Of *kunwar singh
> *Sent:* May 18, 2020 11:54 AM
> *To:* ORACLE-L <oracle-l_at_freelists.org>
> *Subject:* How to run commands as Oracle linux user in Jenkins
>
>
>
> Hi Listers,
>
> I am learning Jenkins for automating oracle database installation etc.
>
>
>
> I have a question, i installed Jenkins.
>
>
>
> *How do i run commands as Oracle linux user. In other words how to i
> switch to Oracle user*
>
>
>
> When i hit build now inside Jenkins Dashboard and see the "Console Output"
> I see this.
>
> --------------------------------------------
>
> Started by user Admin
>
> Running as SYSTEM
> Building in workspace /var/lib/jenkins/workspace/Databaseinstallation
> [Databaseinstallation] $ /bin/sh -xe /tmp/jenkins8356574915939683433.sh
> + whoami
> jenkins
>
> --------------------------------------------
>
> Apologies in advance as it is a basic question, but i am new to this :)
>
>
>
> I reviewed few blog posts but not able to get past it.
>
>
>
> This is my Jenkins version.
>
> <version>2.222.3</version>
>
>
>
>
>
>
>
> --
>
> Cheers,
> Kunwar
>

-- 
Cheers,
Kunwar

--
http://www.freelists.org/webpage/oracle-l
Received on Tue May 19 2020 - 15:29:18 CEST

Original text of this message