-1

On an Ubuntu Server, I was able to run this command manually:

plink FEXT < remoteCmds.txt

where FEXT is the connection session I have created previously. And what this full command does is:

1) to connect to a serial device 
2) to have the commands listed in file "remoteCmds.txt" executed. 

After that, I have put this as a shell command within a java class, and have the java class executed through a Jenkins job.

But it fails that way, and here is the error message I got:

Opening serial device FEXT
Unable to open connection:
Unable to open serial port

This link may close to my case, as this FEXT owns by root, while everything created during a jenkins job, is of user "jenkins".

But after I have enabled "jenkins" user with suggested settings, the error stays.

Cœur
  • 37,241
  • 25
  • 195
  • 267
user3595231
  • 711
  • 12
  • 29
  • I still think you haven't given the right permission to jenkins.... you can confirm it by logging into the Ubuntu server as jenkins user and try to execute the FEXT file directly. – rohit thomas Aug 10 '18 at 03:19

1 Answers1

0

Thanks for the response, but I think I have found the root cause for that, and the answer is really simple.

When "FEXT" was originally created, on Ubuntu, it is saved as a file as "~/.putty/session/FEXT", but when "plink FEXT " is being invoked as part of Jenkins job, the process is searching the "FEXT" under "~jenkins/.putty/session/", which is a different location. Once I have this solved, this failure is gone.

user3595231
  • 711
  • 12
  • 29
  • I have created a soft link of ~jenkins/.putty to point to ~/.putty. In such way, I don't need to make any extra change on the user "jenkins" – user3595231 Aug 16 '18 at 23:41