电脑计算机论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1835|回复: 0

Linux一些目录的理解以及如何设置开机自启动某个程序

[复制链接]
admin 发表于 2021-12-17 11:34:37 | 显示全部楼层 |阅读模式
在学习设置开机自启动某个程序之前,建议你看一下,《linux源码包安装与RPM包安装的区别》,见下面链接:
http://www.jsjlt.com/thread-72059-1-1.html
和《Linux 各目录及每个目录的详细介绍》,见下面链接:http://www.jsjlt.com/thread-65156-1-1.html

1)/etc/rc.d/init.d 这个目录还有一个快捷方式是: /etc/init.d
这个目录下存放的是二进制包安装的程序的启动脚本(rpm或者yum方式安装的),如果是rpm形式安装,相应服务会自动在/etc/rc.d/init.d目录注册的,这只是启动脚本,并不会自动的开机启动
如果要启动这种通过rpm或者yum安装的程序,就可以进入 /etc/rc.d/init.d下去找启动脚本;也可以通过命令:
chkconfig --add 启动脚本  这样启动脚本作为一个服务,以后就可以通过 chkconfig 脚本 on 来设置开机自启动;

    另外在 /etc/rc.d下 还有  rc0.d,rc1.d 这些是对应每个运行级别一个目录,这些目录中是 /etc/rc.d/init.d下的一些脚本的快捷方式,
意思就是: 运行某个级别时,会自动运行这个rc【1-6】.d里的快捷方式


/etc/rc.d/rc.local  这是原文件    /etc/rc.local 这是一个快捷方式,这个文件里可以设置开机需要自动运行的程序

linux 设置开机自动运行 Websphere

启动Websphere的方法为: /opt/WebSphere/AppServer/bin/startServer.sh
第一种方法:vi  /etc/rc.local (或者 vi /etc/rc.d/rc.local)
               添加一行 /opt/WebSphere/AppServer/bin/startServer.sh
第二种方法:
     在 /etc/rc.d/init.d/下新建一个启动脚本 startWebsphere,键入一下内容:
  #!/bin/sh
  /opt/WebSphere/AppServer/bin/startServer.sh

     chmod a+x /etc/init.d/startWebsphere    将启动程序设置可执行权限
     chkconfig --add startWebsphere      添加startWebsphere服务(注意 chkconfig 是 redhat和centos上的命令,其他linux上是没有的,并且 chkconfig也是需要安装的。)
     service startWebsphere start            启动服务
     chkconfig startWebsphere on        将startWebsphere服务设置为自启动
     chkconfig --list | grep startWebsphere   检查startWebsphere是否为自启动



您需要登录后才可以回帖 登录 | 注册

本版积分规则


QQ|手机版|小黑屋|电脑计算机论坛 ( 京ICP备2022023538号-1 )

GMT+8, 2024-5-6 10:58 , Processed in 0.068049 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表