[CentOS] Run as root on reboot

Thu Oct 29 03:50:32 UTC 2020
david <david at daku.org>

At 07:10 PM 10/28/2020, Kenneth Porter wrote:
>--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?


By "initial setup", I meant during the initial install of the 
operating system, starting from "net-install".  Maybe one user is 
defined.  The reboot command is issued from a script that was 
initiated by hand.