[CentOS] Run one-time startup script

Les Mikesell lesmikesell at gmail.com
Wed Sep 25 16:03:26 UTC 2013


On Wed, Sep 25, 2013 at 3:58 AM, Kai Schaetzl <maillists at conactive.com> wrote:

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

Why don't you just do it (except maybe the sql thing) before the
shutdown?   That is, instead of putting a script in place and changing
something else to schedule a later run, just run it and be done.   You
probably already have a way to control them via ssh from a single
location anyway - just run a script there that does them all at once
close to shutdown time.  The config file changes won't take effect
until a reboot anyway.   The sql change is more of a special case
though.   Unless you know all of the code involved, it's likely that
some other components are going to read and cache the old values and
not update after your change.  I'd try to shut that box down last and
make the change at the very end.  Or make sure it starts first and has
the new values before anything else can connect - otherwise you may
have to restart the other components.   If your sql command sets a
field value where the old value matches your old addresses and there
is no overlap in new/old ranges then it wouldn't hurt to run multiple
times so you shouldn't have to be careful about that part..

-- 
   Les Mikesell
     lesmikesell at gmail.com



More information about the CentOS mailing list