开机启动

1.Apache开机启动

[root@localhost ~]# vi /etc/rc.d/rc.local

[root@localhost ~]# cat /etc/rc.d/rc.local 


touch /var/lock/subsys/local

#apache 开机启动

/opt/local/apache/bin/apachectl start


查看Apache是否启动


sudo ./apachectl -S

ps -ef | grep httpd

2.mysql开机启动

yum安装的mysql设置开机启动 

[root@localhost ~]# chkconfig --list | grep mysqld   --查看是否是开机启动

mysqld         0:off1:off2:off3:off4:off5:off6:off

[root@localhost ~]# chkconfig mysqld on    --设置开机启动

[root@localhost ~]# chkconfig --list | grep mysqld   2345处为on,就可以开机启动

mysqld         0:off1:off2:on3:on4:on5:on6:off

这样关闭机器重启验证一下

[root@localhost ~]# netstat -anl | grep 3306

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      

[root@localhost ~]# service mysql status       --查看mysqld是否运行

mysql: unrecognized service

[root@localhost ~]# service mysqld status

mysqld (pid  1582) is running...

[root@localhost ~]# 

3.splunk开机启动

[root@fsfile1 ~]# cat /etc/rc.d/rc.local 


/usr/local/src/splunkforwarder/bin/splunk start   --splunk启动脚本

关机后重启验证

[root@fsfile1 ~]# ps -ef | grep splunk     ---查看是否运行

root      5790     1  5 10:47 ?        00:00:42 splunkd -p 13081 start

root      5791  5790  0 10:47 ?        00:00:00 [splunkd pid=5790] splunkd -p 13081 start [process-runner]

root      6099  4232  0 11:00 pts/1    00:00:00 grep splunk


4.oracle开机自启


[root@dbserver2082 ~]# cat /etc/rc.d/rc.local 



touch /var/lock/subsys/local

su oracle -lc "/opt/u01/app/oracle/product/11.2.0.3/db_1/bin/lsnrctl start"

su oracle -lc /opt/u01/app/oracle/product/11.2.0.3/db_1/bin/dbstart


5.监控软件开机自启

编写一个脚本

我是在/root目录下编写的

[root@pbmsapp ~]#vi jiankong.sh

 #!/bin/bash

/home/patrol/Patrol3/b1config9500.sh &    ——执行这个的时候需要手动按enter才能接着进行,加入&符号就不需要手动按enter键了


/home/patrol/Patrol3//agent_configure.sh -d

/home/patrol/common/security/config_v3.0/sec_configure.sh /home/patrol/Patrol3 0

/home/patrol/Patrol3/PatrolAgent -id 192.168.67.176      --换成你自己服务器的IP

chmod 755 jiankong.sh

然后编辑/etc/rc.d/rc.local

[root@pbmsapp ~]# cat /etc/rc.d/rc.local 

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.


touch /var/lock/subsys/local

/root/jiankong.sh start      --脚本存放的路径


这样关闭电源后再次开机就不需要手动启动了。



本文转自aaa超超aaa 51CTO博客,原文链接:http://blog.51cto.com/10983441/1732637

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值