This is a general design/programming question.

I have been given the responsibility to design the upgrade strategy for our product. The product is run on remote devices with no user interaction. So we have to achieve everything remotely.

The product basically has two daemons/services running S1 and S2. While S2 does all the work and S1 oversees S2. S1 periodically checks S2 and restarts it if it is not running etc.

Now I need to write a self-upgrading capability into S1. S1 has to check with a server and if an upgrade is available it will have to download it (lets call it upgradeFile) and execute it.

Before executing the upgradeFile S1 will stop S2.

upgradeFile, when it executes, will attempt to replace the S1-disk-executable-file and S2-disk-executable-file with the new versions it is carrying.

After the execution of upgradeFile is finished, S1 will restart S2.


Now I am very anxious of the fact that I am replacing the S1-disk-executable while S1 is running. With all the complexity of the loader and VM I am not sure if this is a good strategy.

I have checked the internet forums, books and I haven't found any articles talking about this. I don't even know if I am putting this question in the right forum.

Any help, advice or pointers to articles on this subject would really appreciated. Thank you.

I am currently programming on Linux Mint 14 and Qt 4.8. And we are also developing a new version for Android.