如何解决如何杀死不断重启的孤立进程?
嘿伙计们,我需要知道,因为我在后台启动了一个 python Flask 服务器 manage.py 然后关闭了终端,现在它由 init() 拥有,每当我尝试用 kill -9 ppid
杀死它时,它会不断以不同的 ppid 重生。它在 ubutnut-18.04 上运行。
这里是 manage.py 代码:
import unittest
from flask_migrate import Migrate,MigrateCommand
from flask_script import Manager
from app import create_app,db
from app.users.models import User
app = create_app()
app.app_context().push()
migrate = Migrate(app,db)
manager = Manager(app)
manager.add_command('db',MigrateCommand)
@manager.command
def run():
if app.config['DEBUG']:
app.run(debug=True)
else:
app.run(host='0.0.0.0',port=5000)
@manager.command
def test():
"""Runs the unit tests."""
tests = unittest.TestLoader().discover('tests',pattern='test*.py')
result = unittest.TextTestRunner(verbosity=2).run(tests)
if result.wasSuccessful():
return 0
return 1
if __name__ == '__main__':
manager.run()
------
ubuntu@ip-172-31-6-101:~/CapacityPlanner/flaskapp$ ps -eaf | grep -i flask
ubuntu 1959 1 0 06:02 ? 00:00:02 /home/ubuntu/CapacityPlanner/flaskapp/venv/bin/python manage.py run
ubuntu 3451 3423 0 08:31 pts/0 00:00:00 grep --color=auto -i flask
ubuntu@ip-172-31-6-101:~/CapacityPlanner/flaskapp$ kill -9 1959
ubuntu@ip-172-31-6-101:~/CapacityPlanner/flaskapp$ ps -eaf | grep -i flask
ubuntu 3465 1 36 08:31 ? 00:00:01 /home/ubuntu/CapacityPlanner/flaskapp/venv/bin/python manage.py run
ubuntu 3484 3423 0 08:31 pts/0 00:00:00 grep --color=auto -i flask
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。