1
A
回答
1
如果您正在寻找构建守护程序的模块。我用过这个:https://gist.github.com/slor/5946334
3
请参阅this post关于如何编写脚本以放置在/etc/init.d目录中。唯一的区别是,你必须改变散列砰行指向蟒蛇,而不是bash下
#!/usr/bin/python
def myfunc():
print 'myfunct()'
if __name__ == '__main__':
print 'running python script'
myfunc()
,使文件的可执行
chmod +x myscript
1
金钱豹初始化(HTTP://www.pardus .org.tr/eng/projects/comar/SpeedingUpLinuxWithPardus.html)基于python,理论上你甚至可以用windows可执行文件启动系统(通过Wine当然)。你可以看到一个示例初始化脚本,它使用shell脚本执行几乎相同的事情,但是采用pythonic方式。
相关问题
- 1. Crontab和sh脚本
- 2. boa webserver,sh脚本
- 3. sh脚本逃逸
- 4. sh脚本相当于python脚本
- 5. 的Linux:在.SH脚本
- 6. 在sh脚本中转义?
- 7. Schematron sh脚本不行为
- 8. 误差小sh脚本
- 9. 从java运行.sh脚本
- 10. 参数传递.SH脚本
- 11. Sh脚本是什么`$?`?
- 12. SH - 使用shell脚本
- 13. 如何安装.sh脚本?
- 14. 连续运行sh脚本
- 15. Tomcat sh脚本权限
- 16. 用sh运行bash脚本
- 17. 获得TokenAccess从sh脚本
- 18. groovy脚本 - sh变量
- 19. 从node.js调用sh脚本
- 20. 在jmeter中运行sh脚本
- 21. sh命令不调用shell脚本
- 22. 运行sh脚本的错误
- 23. sh脚本中的布尔表达式
- 24. Android sh脚本阵列问题
- 25. 使用sh脚本中的wget
- 26. 如何让Powershell运行SH脚本
- 27. Bash和Expect - '正在中断.sh脚本
- 28. SH shell脚本不能打破循环
- 29. 执行与参数sh脚本
- 30. 在sh脚本中nohup不起作用
这些脚本应该在shell中编程,而不是在Python中编写。 http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/tocsysinit.html – 2010-11-10 14:10:39
为什么?我相信你,但我想知道理由是什么,特别是我可以遇到什么麻烦。 – mjhm 2010-11-10 14:27:32
为了完整起见,我问了关于ServerFault的问题:http://serverfault.com/questions/200424/init-d-scripts-written-in-python – mjhm 2010-11-10 20:43:26