Capturing the PID of a background process started by a Makefile

▼魔方 西西 提交于 2019-11-30 14:04:54

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>

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!