Gentoo的开机自动启动命令可以写在桌面系统的config里。例如,使用i3,可以在.config/i3/config中添加exec命令行来进行开机自动启动。但是,当执行root权限的命令时,桌面系统是无法执行的。Gentoo继承了许多Linux自动启动的方式。下面介绍一个较为简单的方法。
在/etc/local.d目录添加运行脚本
在/etc/local.d目录下有一个README文件,上面详细描述了该目录的使用方法。
This directory should contain programs or scripts which are to be run
when the local service is started or stopped.
If a file in this directory is executable and it has a .start extension,
it will be run when the local service is started. If a file is
executable and it has a .stop extension, it will be run when the local
service is stopped.