Michael Conigliaro wrote:
> Hey guys,
>
> I noticed that Linux won't let me overwrite the MongoDB binaries while
> they're in use. I get a message like this:
>
> /bin/cp: cannot create regular file `/usr/bin/mongod': Text file busy
>
> If I use lsof/fuser, it looks the executable is actually being held
> open for some reason. I've never seen anything like this before, but
> I've found that I can force overwriting the binary by using cp -f. Of
> course, this closes the open file handle, but the service seems to
> continue working anyway (as far as I can tell).
lsof/fuser should tell you which process/pid is using the binary.
- -aj
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQGUBAEBAgAGBQJNwsjtAAoJEADcfz7u4AZjbMQLv0bX8shvikmPjpxZ/a5dfnJC
NO7iBfrwAMvYXiQWTToOk8pPI6NMxnczzsw9By/mlMwqOudf3zp4dL65XybbhF+1
3QDe5UMcZd612BhOt7IrHWuo8c4iFMUqptN0MGE1ZQd9yrEulh5eQ0XHB5mc+gc1
LR+6mcbalvzaBp0CX0si3FE2VgMAs1ovxQrNZtSC+JVmvSNS/SHnfK90AxXCQevD
wGEMWErtFC0NcYgmdjX3p0BsDLAZmsJkv46d7Xwx6pUTH0OCnnnuQhaw+ulLPSvu
tZkdcX6tmIURf2vmZs8VBVV7126Qh2AS5l2x6PnN5wvRFGMxbxE5u0r4D0bnYFTA
Jh49YBKtBBHIyRA1teyEdaoU/QUbmwLt3KfwUMR3TC+3799kRll4wRgMVjdXw9V7
g7+M43Uy5IY+4ASxvTt+AYLuw53Ti+zI6fWeRNEtR3kjTW5d7k5yzZNzy7m37KM8
p0uZs0aMytnjNVLlM6POTGraBCafuiU=
=izui
-----END PGP SIGNATURE-----
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
"cp -f" on the other hand, unlinks an existing file when open(2) fails,
and creates a new file with the same name. This is a reasonably safe
(albeit non-atomic) way to replace binaries and library files while a
process is running.
Regards,
Richard
> --
> You received this message because you are subscribed to the Google Groups "mo
> ngodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user+unsubscribe@google
tmountain writes:
> Good tip on "cp -f", but I find it hard to imagine how corrupting a
> running process would ever be "desirable behavior".
>
> On May 5, 12:13=A0pm, Richard Kreuter <rich...@10gen.com> wrote:
> > The behavior you're seeing is desirable behavior: if you overwrite a
> > binary (or a library it links to) while the corresponding process is
> > running, you'll corrupt the running process. =A0
> >
> > "cp -f" on the other hand, unlinks an existing file when open(2) fails,
> > and creates a new file with the same name. =A0This is a reasonably safe
> > (albeit non-atomic) way to replace binaries and library files while a
> > process is running.
> >
> > Regards,
> > Richard
> >
> >
> >
> >
> >
> >
> >
> > Michael Conigliaro writes:
> > > Hey guys,
> >
> > > I noticed that Linux won't let me overwrite the MongoDB binaries while
> > > they're in use. I get a message like this:
> >
> > > /bin/cp: cannot create regular file `/usr/bin/mongod': Text file busy
> >
> > > If I use lsof/fuser, it looks the executable is actually being held
> > > open for some reason. I've never seen anything like this before, but
> > > I've found that I can force overwriting the binary by using cp -f. Of
> > > course, this closes the open file handle, but the service seems to
> > > continue working anyway (as far as I can tell).
> >
> > > Is there any reason why I shouldn't do this? The reason I ask is
> > > because it would be really easy to have my configuration management
> > > system overwrite all the binaries for me in preparation for a minor
> > > upgrade. Then I can just go around and manually restart the daemons
> > > when I'm ready.
> >
> > > - Mike
> >
> > > --
> > > You received this message because you are subscribed to the Google Grou=
> ps "mo
> > > ngodb-user" group.
> > > To post to this group, send email to mongod...@googlegroups.com.
> > > To unsubscribe from this group, send email to mongodb-user+unsubscribe@=
> google
> > > groups.com.
> > > For more options, visit this group athttp://groups.google.com/group/mon=
> godb-
> > > user?hl=3Den.
>
> --=20
> You received this message because you are subscribed to the Google Groups "=
> mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user+unsubscribe@goog=
> legroups.com.
> For more options, visit this group at http://groups.google.com/group/mongod=
> b-user?hl=3Den.
>
"cp -f" will produce a new file with an existing file's name, which is a
distinct thing from overwriting an existing file; and something like
that is probably what you want to do.