in Linux operations often encountered in the case of replacing Linux server system programs or business application files, many people will worry, direct replacement will not cause the Linux System program crashes or application crashes, and need to shut down the service to dare to replace, Today, on the FREEBUF website, I accidentally read an article , " How to replace the Linux platform shared library " , and suddenly understood a few of the "strange" phenomena that had not been known before.
These phenomena include, but are not limited to:
Delete part of an application's files, why it won't cause this application to crash
How Nginx and other services can be smoothly restarted
Why some deleted files can be retrieved by lsof based on Inode
Why some applications need to be restarted to take effect after a file is replaced or changed
the answer to the question this article has been given a clear answer. The original (the following text is a direct reference),
for non-loaded so , the static substitution is done directly with the Copy command (CP new.so old.so), and the new so takes effect the next time it loads. For an already loaded original so, replacing it directly with the new so will cause the program to crash, in this case
, so the program can continue to function normally; Delete So just can't see, the system until the program releases so and then really delete the so and inode , so the program can continue to run normally, but in the direct copy replacement, the new so will inherit the original so's inode, the program can not continue to access the original so, causing the program to crash.
Therefore, according to this idea, in the future in the Linux operations work, you can follow this theory to do something, such as whether it is to modify or replace the money to keep the source files, which is why you need to back up before making changes one of the reasons.
Reference article: How to replace a Linux platform shared library
Tag: Production environment, file deletion, file replacement, how to live, operating standards
--end--
This article is from "Communication, My Favorites" blog, please make sure to keep this source http://dgd2010.blog.51cto.com/1539422/1863264
File deletion and replacement in a Linux server production environment