码迷,mamicode.com
首页 > 其他好文 > 详细

centos7下的/etc/rc.local自启动程序

时间:2019-10-19 09:59:22      阅读:83      评论:0      收藏:0      [点我收藏+]

标签:versions   pts   purpose   systemd   启动   添加   rip   权限   sub   

在centos6中有一个/etc/rc.local的启动文件,只要把需要经常启动的程序添加到此文件下并执行source /etc/rc.local就可以实现开机启动了。
在centos7中不知道也是如此操作吗?

    [root@centos ~]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure      
# that this script will be executed during boot.

touch /var/lock/subsys/local
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure ,看到这句话,就会发现需要给文件/etc/rc.local添加执行权限就可以实现程序自启动。

centos7下的/etc/rc.local自启动程序

标签:versions   pts   purpose   systemd   启动   添加   rip   权限   sub   

原文地址:https://www.cnblogs.com/wang50902/p/11702734.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!