Re: [CentOS] Run as root on reboot

2020-10-29 Thread Matthew Miller
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.

-- 
Matthew Miller

Fedora Project Leader
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Run as root on reboot

2020-10-29 Thread Pete Biggs


> 
> 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/html/installation_guide/sect-kickstart-syntax#sect-kickstart-postinstall

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.

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Run as root on reboot

2020-10-29 Thread Gordon Messmer

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.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Run as root on reboot

2020-10-28 Thread John Pierce
On Wed, Oct 28, 2020 at 8:53 PM david  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 ?


-- 
-john r pierce
  recycling used bits in santa cruz
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Run as root on reboot

2020-10-28 Thread david

At 07:10 PM 10/28/2020, Kenneth Porter wrote:

--On Wednesday, October 28, 2020 5:34 PM -0700 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.


"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. 


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Run as root on reboot

2020-10-28 Thread Kenneth Porter

--On Wednesday, October 28, 2020 5:34 PM -0700 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.


"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?


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Run as root on reboot

2020-10-28 Thread John R. Dennison
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


-- 
I thought I was in better shape.

-- Don Pellmann, age 100, who set five world records at the San Diego Senior
   Games, but fell short in the pole vault, dislodging the bar three times,
   New York Times, 22 September 2015


signature.asc
Description: PGP signature
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Run as root on reboot

2020-10-28 Thread Jonathan Billings
On Oct 28, 2020, at 19:58, david  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 

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Run as root on reboot

2020-10-28 Thread david

At 04:47 PM 10/28/2020, Frank Cox wrote:

On Wed, 28 Oct 2020 16:34:32 -0700
david wrote:

> Is there a way to reboot and have a script run without
> intervention.

rc.local

--



Alas, I think rc.local has become irrelevant with systemd, which is 
most Linux distros is the way forward. 


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Run as root on reboot

2020-10-28 Thread Frank Cox
On Wed, 28 Oct 2020 16:34:32 -0700
david wrote:

> Is there a way to reboot and have a script run without 
> intervention. 

rc.local

-- 
Can we uninstall 2020 and install it again? This one has a virus.
MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


[CentOS] Run as root on reboot

2020-10-28 Thread david

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

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos