If you don't understand the Linux system to replace files, it is easy to cause text file busy error prompts at cp, so it is very important to master the Linux system to replace files on the line. Let's go.
Oh Eng has recently found that many do not know the gist replace the file online operations. So the Xiaobian of the System Home has been sorted out so that you can understand.
When replacing a file that is running a process online (including binary, dynamic libraries, resource files that need to be read, etc.). Avoid using cp/scp operations. Instead, you need to use mv/rsync instead.
Cause: cp truncates the source file and writes the new content. That is to say, the process that is opening this file can immediately perceive the modification. Modifying the contents of a file is likely to cause program logic errors or even crashes. And mv is the mark & delete the old file, and then put a new file with the same name in the past. That is to say, the old file and the new file are actually two different files (inode is different), just the same name. The process of opening old files will not be affected. If the process uses mmap to open a file (such as loading so), if the target file is overwritten with cp and the length is smaller. Then when reading the address of the difference part (which actually does not exist in the new file), it will cause the SIGBUS signal. Cause the process to crash.
As for the executable itself. It is not afraid that cp will cause a crash. . Because cp will report & text; text file busy“. At the root of the cp can not. At this time, you should also use the mv class operation. Restart the process after the replacement is complete. The new executable is executed.
The above is the introduction of the Linux system online replacement file notes, if you prompt text file busy in cp, it may be an operational error, should be changed to mv class operation.
In the Uuntu system, many users have set the account name and password, but some users can easily fo
JNDI is a standardized Java naming system interface. In the Jetty container, JNDI can be compiled an
Linux system can modify the color of the shell script output text, so that it can be distinguished f
RedHat is a very popular Linux system. RedHat, including other Linux systems, can u
How to install and upgrade VMware Tools in Fedora
Knowledge about file I/O operations under Linux
What should I do if Ncurses shows Chinese garbled under Linux?
What if CentOS uses MPlayer without sound?
Introduction to multi-threaded shell scripts in Linux system
Linux svn error Cant convert string from how to do?
The method of configuring OpenWRT routing is detailed
How to solve the blue screen when installing VMWare in Linux?
Does the notebook come with a graphics card?
How does the win8 system remove the native software program from the control panel?
How to delete the good pressure software
Sharing the secret of letting the system stop crashing
Let the Recovery Console Enter the Hard Disk
Windows XP crash automatic recognition
Win7 system to determine whether the C disk file can be deleted