English 中文(简体)
Running batch file on remote machine from hudson server using PSEXEC
原标题:

I am new to Hudson with PSEXEC, i am using hudson in my computer, i want to run batch file on remote computer from hudson build. I used PSEXEC to run batch file on remote computer,when i executed from command promt it working successfully.But same i did from Hudson build its hanging..it s not doing anything.so please give any suggestions is there any other way we can handle this.

I want to do this quikly...urgent Anyones help is appreciable

thanks in advance.

问题回答

Could it be that psexec is waiting for a user entry? In this case hudson will hang.

Does Hudson runs with your user credentials? if not lunch a command Prompt with the credentials Hudson is running with and see what happens if you call psexec. If hudson runs on the local system account, you can t start a command prompt with it. Than try to run Hudson with your credentials and see what happens.

BTW, did you check Hudsons log files (just in case that there might be something)?

I had the same problem where PSEXEC simply hung.

The solution i found (after trawling for AGES) was to add the parameter -accepteula to the PSEXEC called. Hudson stopped hanging after that.

Very frustrating.

maybe it is too late, but I thought I will post it for others who have the same problem.

Psexec has problem running from any CI server, doesn t matter what CI server you have, is it Hudson, Teamcity, ...). Psexec hangs when run from the build server. It doesn t hang for all commands, but with some commands , psexec will hang. The problem resides with how psexec will read the output of the remote running command. The ultimate solution is to use other tools than psexec. You can check this blog of this solution. But if you need a simpler solution, and you don t care about the output of the command, I came up with a simple solution that suppress the output of the psexec. You can write a small c# program that will run the psexec command, suppressing its output.

I blogged about that here

I thought I would respond to this since I was having the same hanging problem with TeamCity and psExec. Since I believe it is actually an issue with Java executing psexec, it should apply in the case of Hudson as well.

While I ran into the accepteula issue was early on, you only need to agree once and it sets a registry setting. As user327759 indicates the -accepteula switch in the script would cover your basis the first time and for ever after.

If this doesn t fix your problem, which it didn t in my case, you need to add the "-i" command switch. ex: psexec -i ServerName "C:folderfile.bat"

For context regarding this solution, I have included my backstory:

I was able to execute this PsExec command just fine via a MsBuild task, via a .Net wrapper and via straight command prompt usage, but TeamCity would just hang on the execution. It seems that Java is expecting some response on standard in, when it invokes the psexec exe. On the remote server I would see the psexecsvc process fire up and register in the services console appropriately, but then it would stop. After reading many posts such as this one, and struggling for far longer than I would care to admit, I eventually tried -i option, despite not needing this in any other execution scenario outside of TeamCity. The psexec documentation indicates that -i will "Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session." It is still unclear to me why this makes all the difference for TeamCity.





相关问题
Configure hudson to build multiple branches

I use an ant file to build a java project in mercurial through hudson. The mailnine has a hudson job running just fine. Recently a new branch was created and pushed to the server by commnd line: hg ...

Running automated Web browser tests under Hudson

I m running Hudson for my automated builds and love it. I d now like to create automated Web browser tests using either WaTiN (preferred) or Selenium. As my Hudson runs as a Windows service (under ...

Using Hudson and build steps with multiple git repositories

I m trying out Hudson to replace our current Buildbot setup. I installed the git plugin. Our current setup is like: ssh://server:/repo/test_framework.git ssh://server:/repo/project_a.git Now, to ...

use hudson to get remote tests results

I ve a server running a proprietary language on which I m able to run "unit tests" in this language. I cannot install a Hudson slave on this machine, but would like to have these tests results ...

Where do I see the shell script output in Hudson

I have written a shell script to build my project using hudson. I have put some comments that will be displayed on the console by using echo command. This will help me to debug the scripts if there ...

Why am I getting handshake_failure with Java SSL cert?

I m trying to use Hudson (which uses SVNKit) to access a Subversion repository that requires a client certificate to access it. I can access the same repository using the same client certificate via ...

热门标签