Ubuntu开机启动项的添加
来源:互联网 发布:苹果播放mp4 知乎 编辑:程序博客网 时间:2024/06/05 04:37
依赖于图形系统
GUI 设置
点击菜单:System->Preferences ->Sessions,中文为:系统->首选项->启动应用程序.这里设置的是启动图形界面以后自动运行的程序
修改配置文件
进入 ~/.config/autostart 目录 ,创建以名字加.desktop的文件,如: thunderbird.desktop
不依赖于图形系统的
init
Linux 内核启动 init ,init进程ID是1,是所有进程的父进程,所有进程由它控制。
/etc/event.d
Ubuntu 的启动由upstart控制,自9.10后不再使用/etc/event.d目录的配置文件,改为/etc/init。
runlevel
查看当前的运行级别,Ubuntu 桌面默认是2。
runlevel
Ubuntu 的系统运行级别:
0 系统停机状态1 单用户或系统维护状态2~5 多用户状态6 重新启动 S
切换运行级别,执行命令:
init [0123456Ss]
即在 init 命令后跟一个参数,此参数是要切换到的运行级的运行级代号,如:用 init 0 命令关机;用 init 6 命令重新启动。
/etc/rc2.d
该目录为runlevel=2环境(就是Ubuntu默认情况)的启动项
qii@ubuntu:/etc/rc2.d$ lsREADME S20nginx S20xinetd S50rsync S90binfmt-support S99grub-commonS19postgresql-8.4 S20speech-dispatcher S25bluetooth S50saned S91apache2 S99ondemandS20fancontrol S20wicd S50cups S70dns-clean S91lighttpd S99rc.localS20kerneloops S20winbind S50pulseaudio S70pppd-dns S99acpi-support
其中S表示启动,随后的数字表示启动的顺序。
手动的话将S重命名为K,运行
sudo update-rc.d script defaults
可以禁用某个服务,不过比较麻烦,方便的方法是sysv-rc-conf。
runlevel下的增/删
[编辑]sysv-rc-conf
查看/修改不同运行级别的启动项,可以发现Ubuntu(其实是Debian)2-5之间的runlevel效果是一样的。
sudo apt-get install sysv-rc-conf
sudo sysv-rc-conf
[编辑]update-rc.d
添加启动项,例如mysql
qii@ubuntu:/etc/rc2.d$ sudo update-rc.d mysql defaults update-rc.d: warning: /etc/init.d/mysql missing LSB informationupdate-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/mysql ... /etc/rc0.d/K20mysql -> ../init.d/mysql /etc/rc1.d/K20mysql -> ../init.d/mysql /etc/rc6.d/K20mysql -> ../init.d/mysql /etc/rc2.d/S20mysql -> ../init.d/mysql /etc/rc3.d/S20mysql -> ../init.d/mysql /etc/rc4.d/S20mysql -> ../init.d/mysql /etc/rc5.d/S20mysql -> ../init.d/mysql
删除启动项
qii@ubuntu:/etc/rc2.d$ sudo update-rc.d -f mysql remove Removing any system startup links for /etc/init.d/mysql ... /etc/rc0.d/K20mysql /etc/rc1.d/K20mysql /etc/rc2.d/S20mysql /etc/rc3.d/S20mysql /etc/rc4.d/S20mysql /etc/rc5.d/S20mysql /etc/rc6.d/K20mysql
rcconf
查看,修改当前运行级别的启动项
sudo apt-get install rcconf
sudo rcconf
[编辑]bashrc
Ubuntu默认shell为bash,.bashrc即为配置文件,在用户输入完用户名和密码后生效,可添加启动项目。
[编辑].profile和.xprofile
被KDM读取
/etc/profile
查看KDM读取配置
cat /etc/kde4/kdm/Xsession
[ -f /etc/profile ] && . /etc/profile if [ -f $HOME/.bash_profile ]; then . $HOME/.bash_profile elif [ -f $HOME/.bash_login ]; then . $HOME/.bash_login elif [ -f $HOME/.profile ]; then . $HOME/.profile fi ;;
查看GDM读取配置
cat /etc/gdm/Xsession
# First read /etc/profile and .profiletest -f /etc/profile && . /etc/profiletest -f "$HOME/.profile" && . "$HOME/.profile"# Second read /etc/xprofile and .xprofile for X specific setuptest -f /etc/xprofile && . /etc/xprofiletest -f "$HOME/.xprofile" && . "$HOME/.xprofile"
可见GDM会读取.profile和.xprofile配置文件。
autostart
/etc/xdg/autostart/usr/share/autostart/usr/share/gdm/autostart/usr/share/gnome/autostart~/.config/autostart~/.kde/share/autostart~/.local/share/autostart
这些目录下的启动项目是这样的文件(举例)
Launchy.desktop
KDE SC 4系统设置中设定的启动项便是
~/.config/autostart
只在KDE中自动启动,就是设定.desktop文件的字段
OnlyShowIn=KDE;
- Ubuntu开机启动项的添加
- Ubuntu下添加开机启动项的
- ubuntu添加开机启动项的方法
- ubuntu添加开机启动项
- ubuntu 添加开机启动项
- [ubuntu]添加开机启动项
- ubuntu添加开机启动
- Ubuntu下添加开机启动项的2种方法
- Ubuntu下添加开机启动项的2种方法
- Ubuntu下添加开机启动项的2种方法
- Ubuntu下添加开机启动项的2种方法
- Ubuntu下添加开机启动项的2种方法
- Ubuntu下添加开机启动项的2种方法
- Ubuntu下添加开机启动项的2种方法
- Ubuntu下添加开机启动项的2种方法
- Ubuntu下添加开机启动项的2种方法
- 【转载】ubuntu下添加开机启动项
- ubuntu下添加开机启动项
- IOS应用内付费(IAP)代码实现
- 【cocos2d-x入门实战】微信飞机大战之八:自定义敌机精灵
- QT QTableView用法小结
- android学习路线
- Django框架-Templates进阶用法
- Ubuntu开机启动项的添加
- android开发工具包 androidUtil
- IOS中截屏的实现,很简易的方法
- session工作原理、存储目录、垃圾回收、存储优化等研究
- HTTP状态码详解(转载自)
- 中国合伙人正能量的28句话
- 使用JS读秒使用示例
- 通向架构师的道路(第六天)之漫谈基于数据库的权限系统的设计
- android 软件盘相关