linux基础篇-RHEL实现服务或脚本开机自启动的方法

版权声明:本文为博主原创文章,如需转载请在显眼的地方注明源地址。 https://blog.csdn.net/Dorisnzy/article/details/75324172

有时候我们需要有些服务或者脚本在开机的时候就要启动,有如下方法:

1. 方法一

将启动脚本追加至/etc/rc.local文件中,
用例:echo "sh /tmp/modify.sh &" >> /etc/rc.local

2. 方法二

格式:chkconfig 服务 on
特点:适用于系统上一些标志服务【例如:sshd、iptables等】
用例:chkconfig sshd on

3. 方法三

格式:chkconfig –add 服务
特点:适用于系统上一些非标准服务【例如:rsync等】
用例:chkconfig -add rsync

猜你喜欢

转载自blog.csdn.net/Dorisnzy/article/details/75324172