linux启动后执行脚本(/etc/rc.local文件)

时间:2023-01-29 15:39:59

linux下有一个/etc/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.

改文件的作用是,在所有系统初始化脚本执行完毕后,执行该命令脚本。因此,一些系统初始化的命令,可以放在这个文件中

比如LNMP的启动,避免机器故障重启后服务器忘记启动而导致的故障