快速提问,
我正在使用 Django 中的 python 脚本从网页启动一个 linux 守护程序(运动)。当我使用以下内容时:
def restartRecord():
#restart the service
config_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'recorder/config/motion.conf')
p = subprocess.call(['motion', '-c', config_file])
return True
它启动守护进程没有问题,但如果我使用从 django 开发服务器(端口 8000)运行它,它也会占用端口。这是正常的行为吗?- 为什么启动守护进程会占用那个端口?我可以通过停止开发服务器并尝试重新启动来测试它。
有没有更好的方法来启动这项服务?
干杯,本