|
Home > Archive > Unix Programming > February 2004 > replacing a binary while operational
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
replacing a binary while operational
|
|
| Karthik 2004-02-23, 10:34 am |
| Hi,
I am trying to scp a binary from one machine to another machine nad it
gives me the error message:
scp:/bin/my_prog: text file busy
The program my_prog is actually running on the machine to which i am
trying to copy. Unix allows replacing the binaries on the fly and why
does this error come up and what should i do to prevent this. Also,
my_prog is a program written by me and is more like a daemon process.
thanks
Karthik
| |
| David Schwartz 2004-02-23, 10:34 am |
|
"Karthik" <karthik@nospam.com> wrote in message
news:c1e1nq$1k2$1@proxy1.wright.edu...
> I am trying to scp a binary from one machine to another machine nad it
> gives me the error message:
>
> scp:/bin/my_prog: text file busy
Because the running program needs continuous access to the unmodified
file. UNIX machines don't actually load a file into memory in order to run
it, they just map it into memory and allow it to load in as needed. As a
result, the file cannot be modified while it's being executed.
> The program my_prog is actually running on the machine to which i am
> trying to copy. Unix allows replacing the binaries on the fly and why does
> this error come up and what should i do to prevent this. Also, my_prog is
> a program written by me and is more like a daemon process.
Yes, UNIX does allow *replacing* binaries on the fly, but you're not
trying to replace it, you're trying to modify it. The easiest solution is
probably to 'rm' the file before trying to upload. This will prevent you
from attempting to modify it.
DS
| |
| Barry Margolin 2004-02-23, 11:34 am |
| In article <c1e2bi$n2v$1@nntp.webmaster.com>,
"David Schwartz" <davids@webmaster.com> wrote:
>
>
> Yes, UNIX does allow *replacing* binaries on the fly, but you're not
> trying to replace it, you're trying to modify it. The easiest solution is
> probably to 'rm' the file before trying to upload. This will prevent you
> from attempting to modify it.
And some versions of Unix don't even report the "Text file busy" error,
they simply let you overwrite a program that's in use. The usual result
of this is that the process running the program crashes or gets
erroneous results, because the positions of instructions or data are
different in the new version of the program than the one it started up.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
| |
| Stefan Monnier 2004-02-24, 3:34 am |
| > And some versions of Unix don't even report the "Text file busy" error,
> they simply let you overwrite a program that's in use. The usual result
> of this is that the process running the program crashes or gets
> erroneous results, because the positions of instructions or data are
> different in the new version of the program than the one it started up.
Which "always" happens for sh-scripts (which are just being read rather than
being executed as far as the kernel knows).
Stefan
| |
| Valentin Nechayev 2004-02-24, 6:34 am |
| >>> Karthik wrote:
K> I am trying to scp a binary from one machine to another machine nad it
K> gives me the error message:
K>
K> scp:/bin/my_prog: text file busy
K>
K> The program my_prog is actually running on the machine to which i am
K> trying to copy. Unix allows replacing the binaries on the fly and why
K> does this error come up and what should i do to prevent this. Also,
K> my_prog is a program written by me and is more like a daemon process.
Place it in the same directory with another name and then apply
atomic rename.
-netch-
|
|
|
|
|