How to replace a symolic link with another one without removing it first?
Hi,
For example, I am having a symbolic link of /local/bin linked to /opt/db2test/bin. Now I want to link the /local/bin to /opt/db2/bin instead. Normally, what I would do is to: Unlink it first # unlink /local/bin And re-establish the new link # ln -s /opt/db2/bin /local/bin However, I am in a situation that I cannot remove the old link even just for a second because the running application needs the bin directory. Is there any way that I can establish the new link without going through the step of unlinking the old one? Please help, thanks! ps: either the /opt/db2test/bin or /opt/db2/bin will keep the application running |
Code:
# ln -sf /path/to/target /path/to/link |
I thought I would try the force option before, but it didn't work. It still showed the old link, and didn't establish the new link :(
|
How about stopping the program during this "maintenance" thing?
|
mv newlink oldlink
Create a new link with a different name (like bin2) next to the old one, then move the new one and overwrite the old:
Code:
# ln -s /opt/db2/bin /local/bin2 Code:
$ echo "BIN" > x1 |
@b0uncer
The application is being used by many users, so I don't want to stop it if I can avoid it. @marquardl That would work. Thanks a lot! |
All times are GMT -5. The time now is 06:53 AM. |