[CentOS] how do I run something on a newly installed server, on it's 1st boot only?

John R Pierce pierce at hogranch.com
Sat Mar 29 08:05:41 UTC 2008


Michel van Deventer wrote:
> Hi,
>
> you can use the %post part of the kickstart for that, then your script
> will run after installation is complete but before the reboot. If you
> need to run it after the first reboot, I'd put it in /etc/rc.d/rc.local
> and let it remove itself after running succesfully. And of course copy
> the script to the server using the %post part of kickstart ;)
>   


i was going to suggest building an RPM which installs a script in 
/etc/init.d and enables it in rc1.d-rc3.d, this script checks to see if 
its run before, and if not, it runs, does its thing, then sets some kind 
of marker saying "been there, done that", and disables itself with 
`chkconfig servicename off`

this way the script could be run early in the init sequence (by using a 
low S?? in the symlink) or late, as you so need.







More information about the CentOS mailing list