This problem only happen in docker container.
Only find
is fine:
find ${BASIN_SPIDER_CONFIG_PATH} -type f -name "*.json"
find
with sed
find ${BASIN_SPIDER_CONFIG_PATH} -type f -name "*.json"|xargs sed -i "s/10.142.55.199/host02/g"
gives an error:
/xxx/config/sed8Ey5tD: Device or resource busy
I don't understand what is sed8Ey5tD
, ls
can't see it. I think it is by docker, but can't figure it out.
How to make sed
success?
OK, I found that file is being volumed by docker , there is volumes: /xxx/config.json : /xxx/config/config.json
in docker-compose.yml
. After docker-compose down
, the file can be edit . But how do I edit the file without docker-compose down
?
sed
. When you do in-place modification,sed
will create a temporary file to work on to prevent corrupting your original. If anything went right, then it replace the original with temporary one. But what is your question? You want to know which cause that error or what issed8Ey5tD
file?sed
to make no backup filexargs sed -i'' "s/10.142.55.199/host02/g"
(add single quotes right after-i
key)