Search code examples
gitbatch-filecoldfusionpsexeccfexecute

How to overcome batch file execution part way through when using CFExecute with PsExec to run Git actions?


I’m encountering a weird issue and have tried many different things.

The goal is to have a user click a button on a web page that will execute a batch file on several other servers.

I am using ColdFusion 8. When the user clicks the button, CFExecute launches PSExec.exe to execute the file on remote machine.

excerpt from bat file

cd c:\web\www >> \\firstmachine\c$\web\qa\html\RA\ra.log
git pull origin master >> \\firstmachine\c$\web\qa\html\RA\ra.log

cd c:\web\aaa >> \\firstmachine\c$\web\qa\html\RA\ra.log
git pull origin master >> \\firstmachine\c$\web\qa\html\RA\ra.log

When I run it from a command prompt git runs properly and does a pull from www and aaa. Log file shows everything worked as expected.

c:\web\qa\html\RA\PsExec.exe \\othermachine -u domain\adminaccount -p <password> c:\web\qa\html\RA\script.bat

When I run the same command from CF using CFExecute, git only does a pull on www and not aaa.

<cfexecute name="c:\web\qa\html\RA\PsExec.exe" 
       variable="var" arguments="\\othermachine -u 
       domain\adminaccount -p <password> c:\web\qa\html\RA\script.bat" 
       timeout="50"> 
</cfexecute>

If I swap the lines around, git does a pull on aaa and not www. In these cases the log file shows nothing after the first successful pull, as if the process aborted, but I can not find anything else out of the ordinary.

Any thoughts are much appreciated!


Solution

  • I ended up taking out the batch file and using a separate CFExecute command for each action.