[Tutor] Automatic updates for a program?

Alan Gauld alan.gauld at btinternet.com
Fri May 13 09:38:18 CEST 2011


"Lan Rogers" <lan.rogers.book at gmail.com> wrote

> So I have a program I want to release, but it's still in early 
> stages
> without some of its planned functionality. I want to distribute
> automatic updates.

Don't assume this will be easy, and be prepared for it to
cramp your style when it comes to designing and
developing the app. It will place major restrictions on
what you can do. Only do it if its essential.

> I'm working under the assumption that the easiest
> way to do this is to just replace the old files with the new ones.

A lot depends on which OS you are using.
If its Windows thre are a bunch of other things
you will probably need to do too, like update
registry entries and mess about with COM IDs etc.

> questions is this: How do I replace a script that is running, with a
> new version?

Again it depends on the OS. It may not be possible,
you may have to force a restart. Thats by far the easiest way.
On Windows its common to do it on the next reboot
by setting up a RunOnce job in the registry. (But that
only works well because Windows tends to need
rebooting a lot!)

You might also want to consider whwether you need a
backout strategy to revert to a previous working version.
That will complicate things even more.

OTOH If your program architecture is very simple,
just a few scripts in a single folder and not using
the OS features or a database or networking then
many of these complexities can be avoided. (But
replacing a running process is still tricky. You
need to build the functionality into the existing
code to replace itself - typically using spawn()
or exec() or fork() assuming Linux/MacOS - and
then triggger that functionality from your installer)

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list