Post-deployment script cannot be exited



Hi everyone,
I have been wrestling with this issue for a while without being able to find a solution.

I send my Django code to a server using rsync. After updating the code, I need to do a couple of things, such as running migrations and reloading gunicorn.
I put a bash script on the server, which contains the tasks that I want to perform. Everything goes well, but I am not able to exit the script. Which means that CircleCI never ends the build ! It just keeps going for ever.

I have tried multiple things, putting exit at the end of my script, running the command in the background, adding && exit in the circle.yml file, and nothing seems to do the trick… Any help is welcomed !

My circle.yml file:

    branch: master
      - rsync --update ./ user@mysite:app/
      - rsync -r --update ./myapp/ user@mysite:app/myapp/
      - ssh -i ~/.ssh/id_mysite user@mysite 'app/'

The file:

source /home/ubuntu/.virtualenvs/venv/bin/activate
cd /home/user/app/
pip install -r requirements.txt
python makemigrations
python migrate
ps aux |grep gunicorn |awk '{ print $2 }'|xargs kill
gunicorn -c config/ config.wsgi &
echo 'Post deployment script done'


pipe the output of your script to /dev/null and put the command into the background like:
ssh -i ~/.ssh/id_mysite user@mysite ‘app/ > /dev/null &’