0

I have a shell script at Unix Server which contain sqlplus commands to do some validation.and I can run script using putty and see required result.In Unix server I have set up Oracle path and Library path in .bash_profile file. So when I start putty , it get loaded and can understand sqlplus command.

Now Challenge is

when I call that shell script from Jenkins(Windows node) then I get error "sqlplus command not found". Here I call .bash_profile file first then my shell script which have sqlplus commands.

Please help.

  • Do you use something like [`cygwin`](https://www.cygwin.com/) on windows? If not you can call your `bash_profile` whatever you want, but it is not going to source your commands. Add the location of the binaries to your windows `Path` as well – Rik Dec 29 '16 at 19:24
  • Windows machine is at some remote location and it keep changing as per availability... – shashank srivastava Jan 02 '17 at 08:24
  • Thanks Rik... Could you please suggest – shashank srivastava Jan 04 '17 at 09:24
  • First of all, the binary needs to be on the windows node as well. Then you can either run it from its abolute path `C:\path\to\sqlplus\on\windows\node`, or if you use powershell to run the commands, see [this post](http://stackoverflow.com/questions/714877/setting-windows-powershell-path-variable) or from bat, see [this post](http://stackoverflow.com/questions/6832496/command-prompt-how-to-add-a-set-path-only-for-that-batch-file-executing). If it is a freestyle job, you can put it in the code area as well. Start with `SET PATH=%PATH%;c:\path\to\sqlplus\on\windows\node` – Rik Jan 04 '17 at 09:35
  • Additionally you can coinfigure the windows node "Manage Jenkins -> Manage Nodes -> 'Windows node' -> Configure - > Node properties" And add the path there – Rik Jan 04 '17 at 09:38

1 Answers1

0

Set up the PATH as an environment variable in your Jenkins job definition. More details here:

How to set up environment variables in Jenkins

Community
  • 1
  • 1
codeforester
  • 39,467
  • 16
  • 112
  • 140