How Do I Get Output From The Command Line Runner?

I have read this page but I don't really follow how to get the output of my custom script in the TeamCity log
https://confluence.jetbrains.com/display/TCD8/Build+Script+Interaction+with+TeamCity

This is my custom script

DATE=$(date +%%Y%%m%%d-%%H%%M)
TOOLDIR=/home/teamcity/myproject

cd artifacts
tarball=$(ls -t *.tar.gz | head -n1)
scp "$tarball" teamcity@myserver.com:/home/teamcity/myprojecttar
ssh -f teamcity@myserver.com "./home/teamcity/myproject/stop.sh;sleep 5;pkill -9 -f stopkeyword;rm -rf /home/teamcity/h2;cd /home/teamcity/myprojecttar;tar -xvf $tarball;sleep 5;mkdir -p $TOOLDIR;mv $TOOLDIR $TOOLDIR-$DATE;mv /home/teamcity/myprojecttar/myproject-1.0-SNAPSHOT $TOOLDIR;cd $TOOLDIR;mkdir myproject/work;nohup ./start.sh < /dev/null > std.out 2> std.err &"



Essentially, I locate th artifact, scp it to the deploy server then run some commands over ssh to stop the existing app, deploy it and start it.

This is what is in the log

[22:00:20]Step 2/2: Deploy Artifact (Command Line) (47s)
[22:00:20]Starting: /home/teamcity/BuildAgent/temp/agentTmp/custom_script451762725944296032
[22:00:20]in directory: /home/teamcity/BuildAgent/work/bc43dbf51d0e3224
[22:01:07]Process exited with code 0



The process failed for some reason. How do I get all of the ssh output in the TeamCity log?
1 comment
Comment actions Permalink

It seems like the -f command was hiding the output from the TeamCity log as when I removed it I got the expected data in the logs.

0

Please sign in to leave a comment.