For ages I've gotten used to editing Perl CGI scripts in "vi" and simultaneously having a browser open to test them. Lately, I've been getting "500" server errors when I do that, and when I run the script from the shell, I get "bad interpreter: Text file busy". The only solution is to exit "vi" whenever I want to test the script, which is a royal pain and should be totally unnecessary. What's up with that? I'm running a Debian server, which I keep updated regularly, and I'm assuming it started with some so-called "upgrade" :)
You appear to be having this issue, which is because at some point
That's bizarre. Are you writing it before you attempt to refresh it?
Also, can you 'cat' the file while it's open?
We run into this when editing CGIs...
the #! interpreter line gets Ctrl-M on it somehow,
It looks like a perl error but is really the 'she-bang' interpreter line having 'nearly' invisible characters at the end.
In our case, we found this after the file was written. try using dos2unix command to copy to another name and try hitting that. If it works, you've found your root cause.
Sorry to say that I have no real workaround except to recognise the problem when I see it.
--edit-- Our error message is usually: scriptname: file not found NOT the 'file busy' mentioned in the question.