linux开机启动

 

 1.修改rc.local

在rc.loca添加绝对执行路径

给rc.local内执行脚本添加执行权限

chmod ug+x test.sh

重启

reboot

2.chkconfig

创建脚本

#!/bin/bash
#chkconfig: 2345 88 99
#description:auto_run

yum info ntp && ntpdate cn.ntp.org.cn

移动脚本

mv test.sh /etc/rc.d/init.d

脚本添加执行权限

chmod u+x test.sh

添加到服务

chkconfig --add /etc/rc.d/init.d/test.sh

 

 reboot

 

posted @ 2021-12-06 16:33  斯瓦勃洛  阅读(47)  评论(0)    收藏  举报