My freestyle project never ends or takes abnormally long time

Hi guys,
I am new to Jenkins and came across this issue.
I created a freestyle project. It is parameterised.
In Build Steps, I chose ‘Execute shell’.

#!/bin/bash
source /var/lib/jenkins/.rvm/scripts/rvm
mina assets:reload -vvvv RAILS_ENV=uat INSTANCE=${ENV} PEM=XXXXX

That’s it. When I run this project, sometimes it took more than half an hour to finish. Sometimes it never ended. There was no error reported.
While I execute the above command in terminal, it usually takes 20 seconds to finish.

Thanks in advance for helping me!

Hard to tell from the little information you gave, but looking at the 3rd screenshot, it looks like whatever you are running connects to a server. Are you sure the agent running your job can connect to this server? Did you try to run manually from the same machine as the one running the Jenkins job?

Hi @PierreBtz Thanks for your reply.
Yes, the process did connect to a server.
Actually the job is already done while the output still got stuck there.
I have tried to run the commands manually on the same machine using jenkins user in terminal. They finished with 30 seconds every time.
I am not sure what else I can provide because there was no error or whatever reported.

Actually the job is already done while the output still got stuck there.

So you mean whatever the script is supposed to do is done? You probably want to review what action your script does after the interaction with the server (write to a file? to the console? read something else?). You could try to add print statements each step of your script until you understand exactly which action blocks.