参考:https://blog.csdn.net/qq_18863573/article/details/52437689

pip install supervisor # 要用python2的pip装,环境变量/usr/bin/python指向python2,否则启动supervisor会报错

2.创建supervisor配置文件,命令如下:

进入项目文件(echo_supervisord_conf是/usr/bin/echo_supervisord_conf文件,如果当前环境的python指向python3会报错)

echo_supervisord_conf > supervisord.conf
vim supervisord.conf
在末尾输入:
[program:celery] # celer是superctr stop [name]的name参数 ;command=/usr/bin/celery worker -A tasks
command=/home/zd/virtualenvs/p_manage/bin/python manage.py celery -A test_django worker -B directory=/home/zd/test stdout_logfile=/tmp/celery.log autostart=true autorestart=true redirect_stderr=true stopsignal=QUIT
/usr/bin/supervisord (该运行命令根据你的安装路径为准,安装目录为你所使用的python安装目录下的bin目录内,如果有使用virtualenv请自行区分)
3.supervisorctl查看和停止supervisor的状态:
报错后可查看/tmp/celery.log
supervisorctl
status # 查看状态
reread # 读取配置信息
update # 加载最新的进程
stop # 停止进程
start # 启动进程
reload # 重新加载配置

celery后台运行的更多相关文章

  1. supervisor 使 celery后台运行

    1.安装 supervisor pip install supervisor  2.创建supervisor配置文件,命令如下: 进入项目文件 echo_supervisord_conf > s ...

  2. falsk 使用celery后台执行任务

    # falsk 使用celery后台执行任务 1.基础环境搭建 doc:https://flask.palletsprojects.com/en/1.0.x/patterns/celery/ mkdi ...

  3. Linux scp 设置nohup后台运行

    Linux scp 设置nohup后台运行 1.正常执行scp命令 2.输入ctrl + z 暂停任务 3.bg将其放入后台 4.disown -h 将这个作业忽略HUP信号 5.测试会话中断,任务继 ...

  4. docker进入后台运行的容器

    转载请注明出处   我们运行docker容器的时候,使用了-d参数,把容器在后台运行后. 这个时候,我们使用docker ps命令,我们就可以知道哪些程序在后台运行.   我们要怎么进入到docker ...

  5. python脚本后台运行

    问题描述: 环境: CentOS6.4 一个用python写的监控脚本test1.py,用while True方式一直运行,在ssh远程(使用putty终端)时通过以下命令启动脚本: python t ...

  6. linux 让程序在后台运行的几种可靠方法

    我们经常会碰到这样的问题,用 telnet/ssh 登录了远程的 Linux 服务器,运行了一些耗时较长的任务, 结果却由于网络的不稳定导致任务中途失败.如何让命令提交后不受本地关闭终端窗口/网络断开 ...

  7. linux进程后台运行及输出重定向

    本机环境为ubuntu 14.04 以ping www.baidu.com为例: 1.程序的前台运行 ping www.baidu.com 可以看到,屏幕上输出了baidu返回的结果 2.实现程序后台 ...

  8. APP长时间后台运行

    *  参考:http://www.nivalxer.com/archives/187 首先,我要说明的是在iOS中,一般应用程序在后台挂起之后仅拥有3分钟时间来处理相应的未完成事件,但是3分钟之后就会 ...

  9. iOS开发小技巧--iOS程序进入后台运行的实现

    iOS程序进入后台运行的实现 视频中看到老师用的iOS7,代码中有开启timer,无限请求数据的功能,但是切换到后台,代码就不打印了 自己用的iOS9,进入后台还是可以打印的,再次进入前台也可以正常运 ...

随机推荐

  1. ProxySQL初体验

      Preface       As we all know,it's a common sense that separate reading and writing operations can ...

  2. Appium iOS万能的定位方式--Predicate(iOSNsPredicate)

    所谓Predicate定位即Java-Client -5.0.版本以及Appium-Python-Client 0.31版本更新后增加的新的定位方式: 举个例子: JAVA代码: //输入账号和密码 ...

  3. LuffyCity-CMDB实战

    第1章 章节一 课时01-ITIL介绍 课时02-CMDB介绍 课时03-CMDB需求讨论 课时04-CMDB需求讨论2 课时05-CMDB表结构设计 课时06-CMDB表结构设计2 课时07-CMD ...

  4. result returns more than one elements此种错误,解决

    场景:公司产品开发完成后,接入第三方厂商,在进行接口联调的时候出现此问题.此接口报文中的每一个数据都要进行校验,有些是与已经存入产品数据库中的数据进行对比,看是否存在. 问题:在测试中,有些测试没有问 ...

  5. Thymeleaf 使用时的标签

    1 . onclick事件   <a th:onclick="'javascript:more()'" ></a> 2.引入CSS样式 <link t ...

  6. LeetCode - 70. Climbing Stairs(0ms)

    You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb ...

  7. [leetcode-609-Find Duplicate File in System]

    https://discuss.leetcode.com/topic/91430/c-clean-solution-answers-to-follow-upGiven a list of direct ...

  8. 【转】hexo博客图片问题

    1.首先确认_config.yml 中有 post_asset_folder:true. Hexo 提供了一种更方便管理 Asset 的设定:post_asset_folder 当您设置post_as ...

  9. Linux yum安装MySQL5.7,及远程连接mysql(亲测有效!)

    一.安装配置MySQL的yum源 # 安装MySQL的yum源,下面是RHEL6系列的下载地址 rpm -Uvh http://dev.mysql.com/get/mysql-community-re ...

  10. HDU 1028 整数拆分问题 Ignatius and the Princess III

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...