I've got a Jenkins hooked up to a Bitbucket repository. When something is pushed to the repository the Jenkins starts a job. This job gets all data from the repository (server.py: which is basically a bjoern server). What I want to do now is stopping the server.py-process which is running and restart it with the changed data. This should be done by the following bash script which is run by the jenkins:
#!/bin/bash
PID=$(ps ax | grep 'server.py')
kill $PID
My problem is that the jenkins user on my ubuntu server can't kill the server.py process. How can kill the process?
Or is it possible to catch the server.py process and stop the bjoern server instance with a function call?