创建一个python守护进程 [英] Creating a python daemon

查看:71
本文介绍了创建一个python守护进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,用于流式处理Twitter,并从中捕获实时数据.然后针对我工作产品所在的公司对该数据进行分析.

I have a script that streams twitter, and catches real-time data from it. This data is then analyzed for the company where I work's products.

问题是,我希望此脚本可以在服务器上连续运行而无需监督.我不知道如何执行此操作,到目前为止,我在stackoverflow上阅读的内容都非常复杂.谁能告诉我用python创建守护进程的基本过程,以及如何进行?我目前正在通过 http://www.gavinj.net/2012/06/building-python-daemon-process.html ,这是一个很好的教程,但我也希望有另一种意见.

The issue is, I want this script to continuously run on a server without having to supervise it. I have no idea how to do this, and whatever I read on stackoverflow so far has been really complicated. Can anyone tell me the basics of the process of making a daemon process in python, and how one would go about it? I am currently going through http://www.gavinj.net/2012/06/building-python-daemon-process.html, and it is a good tutorial,but I would like another opinion too.

推荐答案

我还使用python创建了一个twitter客户端,以收集实时数据,

I also made a twitter client in python to collect real time data,

我将其设置为按计划运行,它每10分钟运行一次,以防止超出速率限制,

I set it up to run on a schedule, it runs every 10 minutes to prevent going over the rate limit,

我正在使用Mac OSX,并且设置了一个启动"任务来运行python脚本,

I am using Mac OSX and I set up a "launchd" task to run the python script,

您需要创建一个"plist"文件来配置运行时间表,此页面将为您提供帮助. http://launched.zerowidth.com/

You need to create a "plist" file that configures the run schedule, This page will help. http://launched.zerowidth.com/

这篇关于创建一个python守护进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆