该方法未经本人实践!
http://www.yihaomen.com/article/python/190.htm
写了一个python 服务程序,但每次都在控制台下启动,感觉很不好,始终有个console界面,所以就想把他加入到系统自动启动中。
在ubuntu 11.10 中,进入 /etc 目录
程序代码
cd /etc
sudo gedit rc.local
增加内容:
程序代码
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
cd /home/summer/MyService/iNet/inetgarment
python serversocket.py
exit 0
然后重新启动就可以了。
本文来自博客园,作者:{Julius},转载请注明原文链接:https://www.cnblogs.com/bestechshare/p/16447909.html
可微信加我,了解更多,WeChat:{KingisOK}