Bash 'Kill' Command terminates step permaturely

Greetings Deployment Gods,

I am trying to run a small bash script to stop a process and take a backup of the existing .jar file in a single deployment process step. The script looks something like the following:

PID=$(pgrep -f AppName)
if [ “$PID” == “” ]
echo “App is not running.”
echo “Attempting to stop the app…”
kill $PID
echo “App stopped”.

#Backup the app
cp app.jar app.jar.bak

It appears to be hitting the ‘kill’ command (successfully stops the app most of the time) but the following echo message doesn’t appear and the backup bit isn’t run either.

Any ideas? Where am I going wrong?



Greetings Loyal Follower,

Thou shall check that the PID is the value you expect, by enumerating the processes using ps as well as outputting PID. Thou may have sinned and smited the script process.

The offering of the resulting deployment log shall please us.

Rob W

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.