[CentOS] Run as root on reboot

Thu Oct 29 07:32:30 UTC 2020
Gordon Messmer <gordon.messmer at gmail.com>

On 10/28/20 4:34 PM, david 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.  The output of the command would still show up 
> on the terminal that initiated the reboot.


Having read this thread, I still can't tell *when* you want a script to 
run.  If you want it to run during the initial install, then I can't 
make any sense of how that relates to a reboot.

If you want to run a command during the setup, then provide a kickstart 
file with a %post section:
https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#chapter-6-post-installation-script

If you want to run a command after rebooting and display the command 
output on the console, then use the openvt command, possibly with the -w 
flag:
https://linux.die.net/man/1/openvt


> Security is not a concern here.  And I don't want to invoke 
> high-powered functions like "jumpstart".


If you mean kickstart: I'm pretty sure that's your only option for 
running commands during the installation.