[CentOS] Run as root on reboot

Thu Oct 29 02:10:00 UTC 2020
Kenneth Porter <shiva at sewingwitch.com>

--On Wednesday, October 28, 2020 5:34 PM -0700 david <david at daku.org> wrote:

> During initial setup, I'd like to avoid the manual actions of logging on
> as root and executing a command, but instead have that command run
> without intervention.

"During initial setup" is vague. Lots of stuff happens during startup. With 
systemd, you can control what triggers your script to run. Does it need the 
filesystems up? Does it need networking? This will be a part of your 
systemd unit file.

> The output of the command would still show up on the terminal that
> initiated the reboot.

This one might be hard. Is there a way to know where a reboot command came 
from? Does the kernel or systemd save this somewhere?