使用Fabric使用Nohup启动后台进程 [英] start a background process with nohup using fabric
本文介绍了使用Fabric使用Nohup启动后台进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
am尝试使用以下nohup命令使用结构启动celerycam进程.不幸的是,什么也没发生,手动使用相同的命令可以启动该过程,但不能通过结构启动.关于如何解决这个问题的任何建议?
am trying to start a celerycam process using fabric using the below nohup command. Unfortunately, nothing is happening, manually using the same command i could start the process but not through fabric. Any advise on how i can solve this?
def start_celerycam():
'''Start celerycam daemon'''
with cd(env.project_dir):
virtualenv('nohup bash -c "python manage.py celerycam --logfile=%scelerycam.log --pidfile=%scelerycam.pid &> %scelerycam.nohup &> %scelerycam.err" &' % (env.celery_log_dir,env.celery_log_dir,env.celery_log_dir,env.celery_log_dir))
推荐答案
我正在使用Erich Heine的建议使用'dtach',并且对我来说效果很好:
I'm using Erich Heine's suggestion to use 'dtach' and it's working pretty well for me:
def runbg(cmd, sockname="dtach"):
return run('dtach -n `mktemp -u /tmp/%s.XXXX` %s' % (sockname, cmd))
发现此问题此处.
这篇关于使用Fabric使用Nohup启动后台进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文