|
在学习设置开机自启动某个程序之前,建议你看一下,《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是否为自启动
|
|