[CentOS] Run one-time startup script

Carl T. Miller carl at carltm.com
Fri Sep 20 12:42:44 UTC 2013


Kai Schaetzl wrote:
> Changes largely involve removing old files and putting new files in place
> (resolv.conf, hosts, sysconfig/network + network-scripts, firewall,
> postfix, httpd etc.). The only other change besides replacing files would
> be changing the IP address in a webcontrol interface in a MySQL table, so
> this part has to be done after MySQL startup.

If I needed to do this, I would start by making a tarball
of all files that need to changed.  Then I would edit the
files as needed and make a tarball of the new version.

Next I would write two scripts, one to enable the new
settings and one to restore the old settings.  At the
end of each script restart network services.  Then
create an at job to enable the new settings at now+2min
and another to restore the former settings at now+7min.

In two minutes you should be able to ssh to the host
and cancel the second at job.  If anything goes wrong,
just wait 5 minutes and old network settings are back.

c





More information about the CentOS mailing list