[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Keeping a customized file from being updated during package upgrade



Ken Long wrote:

I have a question that I hope someone can help me with.

As some background, we had a problem where every once in a very long
while, someone (usually me O:) ) would get a little ahead of themselves
and issue a shutdown command to shut down the system they were logged in
on.  Problem was, the person would be in a rush and not notice they were
actually still ssh'ed into another machine when they typed it!  As you
can imagine, doing a "shutdown -h now" on your mail server when you're
sitting at home (over an hour away) is not a pleasant thing to have
happen.
Sooooo, I had this bright idea to replace shutdown with a script that
would take an additional parameter of the hostname of the system.  The
script would then check the hostname given on the commandline against
the hostname of the system it was being run on and only pass on the rest
of the parameters to the real shutdown command if they matched.

Soooo, the short of it is that now, /sbin/shutdown is this script and
the stock shutdown command is /sbin/shutdown.real

So, here is my question.  How can I make it so that if I upgrade the
sysvinit package on a system, it will either just not touch the
/sbin/shutdown file, or better yet, redirect the new /sbin/shutdown file
to /sbin/shutdown.real instead?  Is that possible?

Thanks in advance for your help!

-Ken


Others have answered the question you asked. I was wondering if it wouldn't be worthwhile to put your script in /usr/local/sbin instead of replacing /sbin/shutdown? I don't know if /usr/local/sbin is before /sbin in root's path, but it seems that /usr/local typically comes first. That way, when you upgrade sysvinit, /sbin/shutdown gets replaced as normal, and your script is untouched.

I guess it doesn't help if you are in the habit of typing the full path to the command...

Nate

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: