3

I have a script running in a server, which is calling a function in a class. This is a long function, with a foreach importing data, which has been running for a couple of hours and it is estimated to keep running for a couple more.

Now I was asked to do an update on this file (on another function). My question is, if I update this on the server, will that affect the running of the current script? How does this work, the server has those instructions cached and the new file won't affect them? Or it will? I'm confused!

luqita
  • 4,008
  • 13
  • 60
  • 93

2 Answers2

6

Unless the script recalls him self with a include no it will not be updated. The first time the script is invoked it is in memory. But if you have some recursiveness and it reincludes itself then yes it will be the updated version.

Iznogood
  • 12,447
  • 3
  • 26
  • 44
1

As @Iznogood wrote you can't know if script will be reloaded, so why to take a risk? You can use something like following to run the update only after the execution is finished:

while ps -p SCRIPT_PID; do sleep 1; done ; svn up /path/to/script

Inspired by: https://stackoverflow.com/a/7485831

Community
  • 1
  • 1
Paker
  • 2,522
  • 1
  • 16
  • 27