Linux开机程序自启动实现

1.使程序在登录之前自动启动
把相应的启动脚本或者程序启动命令加入到inittab或者/etc/rc.local脚本中
注意此时还没有加载profile配置,无法使用登录后的环境变量

2.使程序在登录后自动启动
所有用户登录都自动启动:把脚本或程序放到/etc/profile脚本文件中
特定用户登录自动启动:把脚本或程序放到用户home目录下的相应配置文件中,如:.bash_profile/.bash_login/.profile

3.使程序在登出时自动运行
把脚本或程序放到用户home目录下的.bash_logout文件中

Tagged . Bookmark the permalink.

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="">