I am usnig SSH plugin to run commands on Linux server, i started one script using SSH that script takes more than 1 hr time to run , i dont want to wait that much time so i put 30 sec time at Exec time out . But it showing error ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 30,000 ms] and it is unstable. I dont want to unstable my build , for that i used Jenkins text finder to stable this build . In that jenkins Text finder i searched the string in Regular expression is "Exception when publishing " . But still my build is unstable. please help me in this issue.
问题:
回答1:
You've set a timeout for Publish over SSH Plugin which has nothing to do with your build step (which is - or should be - Execute shell Script on remote host using SSH). You probably have a Send build artifacts via SSH post-build step that then fails due to that timeout.
The confusion here is that options for Publish over SSH Plugin and SSH Plugin are set in the same section.
回答2:
Since you are executing a script from a non-TTY environment; The Jenkins is not able to get the exit properly, out of your script.
What you want is to exit immediately, after script execution! Don't want to wait for the entire timeout to happen and then disconnect improperly!
Solution: Make it Exec in PTY. (Please tick the check-box as shown in attached screenshot)
I had the same issue and it is working perfect for me now.
回答3:
This is how I got this to work: