Linux Ubuntu 20.04 —添加开机启动(服务/脚本)

Linux Ubuntu 20.04 —添加开机启动(服务/脚本)

系统启动时需要加载的配置文件

/etc/profile、/root/.bash_profile
/etc/bashrc、/root/.bashrc
/etc/profile.d/*.sh、/etc/profile.d/lang.sh
/etc/sysconfig/i18n、/etc/rc.local(/etc/rc.d/rc.local)

一、修改开机启动文件:/etc/rc.local(或者/etc/rc.d/rc.local)

 (本人未验证)

二、自己写一个shell脚本

测试有效

将写好的脚本(.sh文件)放到目录 /etc/profile.d/ 下,系统启动后就会自动执行该目录下的所有shell脚本。

注意:添加脚本的可执行权限
chmod +x /etc/rc.d/init.d/test.sh

你可能感兴趣的:(数字空间建设指南,深度学习,linux,区块链,ubuntu,shell)