链接存档:Daemonize a [perl|python] script as Linux service

刚好正在折腾想把一个脚本弄成daemon的系统服务,普通的脚本不能直接用/etc/init.d/functions里的daemon函数来放置后台。看了一下代码,它只是把程序的输出给重定向了,但是从当前shell detach这个活还得脚本自己来干…都不知道加个&,居然好意思叫daemon…

偶然间找到这个,觉得有用,先存下来:

http://executionexception.wordpress.com/2010/06/18/moosexdaemonize-and-init-d/

可惜我用的是python…于是继续找

google search的第一条记录:

http://motomastyle.com/daemonizing-a-python-script/

总的来说,还是得自己做detach,然后发现其实这里有相关代码的详细的注解:

http://code.activestate.com/recipes/278731-creating-a-daemon-the-python-way/

本文网址:http://blog.perlfect.me/2010/11/15/daemonize-a-perl-script-as-service.html

comments powered by Disqus