-1

I have a jenkinsfile from which I am autodeploying a play framework application. To kill the current pid on the server I use the following command:

sudo kill $(cat /var/www/myProject/PLAY.pid)

I've tried escaping the dollar sign as suggested without success. The Jenkins log returns

Kill: command not found

Is this a syntactical error or is there a problem invoking 'kill' from Jenkins on ubuntu 18.04?...

I can't see any documentation on the Play Framework website for starting and stopping packaged binaries using an automated shell script.

paynod
  • 19
  • 1
  • 7

1 Answers1

0

Whatever your are trying to do in Jenkins pipelines you have to escape $ characters so been said that you have to do:

sh "sudo kill \$(cat /var/www/myProject/PLAY.pid)"

Please, notice the "\$".

Daniel Hernández
  • 4,078
  • 6
  • 27
  • 38
  • Thanks for your response Daniel. Apologies, I had already tried this resolution and put it down to being a syntax error as I was still getting errors in the Jenkins log. I've edited the original post. – paynod Dec 13 '19 at 22:06