Folks
Is there a way to reboot and have a script run without intervention. 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.
Security is not a concern here. And I don't want to invoke high-powered functions like "jumpstart".
David
On Oct 28, 2020, at 19:58, david david@daku.org wrote:
Alas, I think rc.local has become irrelevant with systemd, which is most Linux distros is the way forward.
I suggest running:
systemctl cat rc-local.service
The trick is to make the /etc/rc.d/rc.local file executable.
However, honestly, what you are asking for should be to create your own systemd service to launch on boot. Systemd service units are trivial to write.
-- Jonathan Billings billings@negate.org
On Wed, Oct 28, 2020 at 04:56:53PM -0700, david wrote:
Alas, I think rc.local has become irrelevant with systemd, which is most Linux distros is the way forward.
vi /etc/rc.local -> add what you need to run on boot chmod 700 /etc/rc.d/rc.local systemctl enable rc-local.service
It's still supported, but disabled by default by both the unit being disabled and the file being non-executable. This works on 7, no idea about 8. They probably broke it there.
John
--On Wednesday, October 28, 2020 5:34 PM -0700 david david@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?
At 07:10 PM 10/28/2020, Kenneth Porter wrote:
--On Wednesday, October 28, 2020 5:34 PM -0700 david david@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.
On Wed, Oct 28, 2020 at 8:53 PM david david@daku.org wrote:
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.
so you want this script run /before/ the manually issued reboot ? why not just run the script and have IT initiate the reboot when its done ?
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.
So you want it to run as the final part of the install process??
If that's the case, then you should create a kickstart file with the post installation script in it:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/htm...
If you want/need it to run the script after the install has completed and the first reboot, then you need to look at the FirstBoot scripts
https://access.redhat.com/solutions/2028143
P.
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-p...
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.
On Wed, Oct 28, 2020 at 04:34:32PM -0700, david wrote:
During initial setup, I'd like to avoid the manual actions of
[...]
Security is not a concern here. And I don't want to invoke high-powered functions like "jumpstart".
Can you explain the use case a little more here? It may actually _really_ be worth your time to learn about kickstart -- it's highly powerful, but not really "high-powered" in a difficultly sense.