> cherryd -h
Usage: cherryd [options]
Options:
-h, --help show this help message and exit
-c CONFIG, --config=CONFIG
specify config file(s)
-d run the server as a daemon
-e ENVIRONMENT, --environment=ENVIRONMENT
apply the given config environment
-f start a fastcgi server instead of the default HTTP
server
-s start a scgi server instead of the default HTTP server
-i IMPORTS, --import=IMPORTS
specify modules to import
-p PIDFILE, --pidfile=PIDFILE
store the process id in the given file
# this works for cherrypy 3.1.2 on Ubuntu 10.04
from cherrypy.process.plugins import Daemonizer
# before mounting anything
Daemonizer(cherrypy.engine).subscribe()
cherrypy.tree.mount(MyDaemonApp, "/")
cherrypy.engine.start()
cherrypy.engine.block()
我编写了一个教程/项目框架cherrypy-webapp-skeleton,其目标是填补在Debian*上为web开发人员部署真实的CherryPy应用程序的空白。它具有扩展的
cherryd
用于守护程序权限删除。还有一些重要的脚本和配置文件,用于init.d
、nginx
、monit
、logrotate
。教程部分描述了如何把事情放在一起,并最终忘记它。框架部分提出了一种可能的CherryPy webapp项目资产安排方法。*它是为挤压而写的,但实际上对于喘息应该是一样的。
默认情况下,有一个用于CherryPy的Daemonizer插件,它对于启动CherryPy很有用,但对于简单的情况,最简单的方法是使用cherryd脚本:
就init.d脚本而言,我认为有一些例子可以通过谷歌进行搜索。
而
cherryd
在您的:或在:https://bitbucket.org/cherrypy/cherrypy/src/default/cherrypy/cherryd
守护程序的使用非常简单:
There is a decent HOWTO for SysV style here.
总结一下:
在
/etc/init.d
中为应用程序创建一个名为的文件,该文件调用/bin/sh
sudo vim /etc/init.d/MyDaemonApp
使其可执行
sudo chmod +x /etc/init.d/MyDaemonApp
运行
update-rc.d
在正确的运行时目录中创建正确的链接。sudo update-rc.d MyDaemonApp defaults 80
sudo /etc/init.d/MyDaemonApp
相关问题 更多 >
编程相关推荐