Skip to content

Instantly share code, notes, and snippets.

@huobazi
Created July 22, 2011 04:22
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save huobazi/1098886 to your computer and use it in GitHub Desktop.
Save huobazi/1098886 to your computer and use it in GitHub Desktop.
添加 删除ubuntu自启动服务 init.d
1. 装个 sysv-conf-rc
2. sudo update-rc.d -f mysql remove 删除mysql随机器启动的服务
sudo update-rc.d -f apache2 remove 删除apache2随机器启动的服务
3. 查看/etc/rc2.d/里面的apache和mysql启动脚本,通常都是两个阿拉伯数字后再接一个英文字母,再加脚本名称。英文字母 是S的都是会自动启动的,K则相反。所以只要找到apache和mysql的启动脚本,把S改成K就可以了
添加一个服务
#sudo update-rc.d 服务名 defaults 99
删除一个服务
#sudo update-rc.d 服务名 remove
临时重启一个服务
#/etc/init.d/服务名 restart
临时关闭一个服务
#/etc/init.d/服务名 stop
临时启动一个服务
#/etc/init.d/服务名 start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment