I have a Makefile that starts a Django web server. I would like the server to be started in the background, with the PID saved to a file.
My recipe looks like this:<
If Make gives you too much trouble, you can always have the target launch an sh script; in that script, launch the process, background, and then output the pid to a file.
Just leave a single ampersand, without a semicolon after it:
run: venv
@"${PYTHON}" "${APP}/manage.py" runserver 80 & echo "$$!" > "${LOGDIR}/django.pid"
Ampersand acts as command separator in the same way as a semicolon:
<command> & <command>