Jenkins hangs after executing SSH Command

39 views
Skip to first unread message

stefan.schum...@gmail.com

unread,
Mar 8, 2018, 9:44:15 AM3/8/18
to Jenkins Users
Hello

I have a Jenkins job which is supposed to execute a command after uploading to the webserver. It's a simple script which kills the current npm process, writes the date to a file and restarts the server. 

#!/bin/bash
kill $(ps faux | grep server.js | grep node | cut -f2 -d' ')
cd /var/www/chatbot
date >> chatbot.log
nohup npm start &

When I execute it as user www-data on the console everything works fine. Unfortunately this is not the case when running from Jenkins. Jenkins executes the command, receives the following output and then stalls 
until I kill the build manually. How can I force Jenkins to disconnect and consider the build a success after executing server-neustart?

SSH: EXEC: STDOUT/STDERR from command [/usr/local/bin/server-neustart] ...
> NetFed-...@0.1.1 start /var/www/chatbot
> node server.js

Yours Sincerely
Stefan
Reply all
Reply to author
Forward
0 new messages