Reindl Harald wrote on Fri, 20 Sep 2013 14:32:46 +0200:
> /etc/rc.d/rc.local
Thanks for all the answers.
First, I omitted to explicitely state that these are web servers. There is
no dhcp, only one or, in a few cases, a few IP static IP addresses. Mostly
Centos 5. Changing the data is *not* the problem. As already said this
will mostly be done by replacing config files (cp -a, not mv, this assures
it can be done even more than once without a problem, replacement
operations in files always ask for trouble if something non-standard
happens, not to mention one has to code this - it's easier just to provide
the correct new files), and by reading in a sql command that replaces an
IP address in some tables.
The big question is when and how to do this.
rc.local seems to be a good place for reading in the sql command. But it
doesn't seem to be a good place for all the other commands, especially the
initial network setup. It's executed *after* all ini stuff is done, e.g.
all daemons and network are started. Problem is that some network services
may hang the whole machine for a minute or longer if they cannot establish
networking (which would be the case with wrong data either for the ifcfg
files or the config file of the daemon). At the moment I know of only one
daemon which behaves this way (bigsister), but I may have forgotten about
others. I don't want to wait until the timeout kicks in, the init
continues and rc.local eventually issues a service network restart.
So, I would rather do all the "replace file" operations before any of that
init stuff gets done. Is this possible without much ado? Or should I
rather do the "replace file" operations at shutdown (how, when?) and
execute only the sql command from rc.local? Google suggests a file
/etc/rc.shutdown (or rc.local.shutdown?) which, if I understand correctly,
would be carried out after the init stuff for the shutdown (rc0) has been
done.
Kai