Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let say I have a KSH script my_script.ksh that performs complex operations including but not limited to invoking SQLPLUS to manipulate large number (millions) of records in an Oracle database. The script accepts a few parameters that determine which sets of records it will process and suppose it takes hours to manipulate each set of records.

I am now having an instance of the script running on the Unix server using NOHUP and & command options, that is to say that it's currently running in the background and is detached from the telnet session that I used to invoke the script.

Suppose I've modified the script locally on my desktop PC in order to make the subsequent executions of the script faster and to add some audit mechanism, and I am about to upload the script onto the server.

Will my uploading the modified version of the script affect the process that is currently running the script? I don't want to kill the process and start all over again on the current record set and I'm afraid to try and error since I can't be sure how destructive it would be. Any advise from experienced admin/user?

share|improve this question
up vote 2 down vote accepted

Any shell will be confused if you modify the script file while they are reading it. The problematic time window can be very small if the shell reads the whole script file before starting to execute it. I don't know whether ksh does that.

If you make sure to create a new file rather than modify the existing file, i.e., ln myscript myscript.running; mv -f myscript (or any other method which moves the new script into place rather than modifying the existing file), you shouldn't have any problem.

share|improve this answer

It won't work very well. If you modified your script while it's running, it's very likely to get a syntax error.

I've experienced it with bash and dash. I don't think it's that different from ksh. Even MS batch fails on this.

share|improve this answer

Any ksh script will get it's own shell, all functions get loaded first, and then the script is interpreted. At run time. Any changes on disk made during execution will not be reflected in the currently running job.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.