Jump to content
jdebuhr

Updating a user built App within itself

Recommended Posts

I was not sure where this question would go so i thought the general forum was a good place to start

I have a LabVIEW app running on a WinXp Touch screen, What I would like to do is have the app look for an update (which would be in a specified directory) If it sees there is a new app avail, What would be the best way to exit the current App, copy the new one in its place and relaunch.

The app would require that the end user selects to update ( the update would not be forced) once selected.

I am thinking that I would have to launch a second app to copy the main app, close the main app, copy the updated version then launch the new updated app. What is the best way to approach this?

Edited by jdebuhr

Share this post


Link to post
Share on other sites

Hi,

I think the best way is to create a daemon program checking at a specific place for a new program version. If a new program is present, maybe you could send an order (TCP based comm for example) to the main app to shut it down...

When the update is done, simply relaunch the new app with a terminal command for example...

Share this post


Link to post
Share on other sites

As mentioned, a daemon always polling for updates is the most robust method. This allows for the updater app to make significant changes, without user interaction. The main app can update the updater whenever necessary. (Would eventually be very infrequent) Either by the updater sending an "update me" message, or the main app polling.

A simplistic approach is to use batch files. Your app will poll for updates. When found, create a batch file that completes the copy, and restarts your app. In the most sloppy method, running the batch file (without waiting for the return) and immediately exiting can work. This is also the fastest to create, but harder to maintain over time.

Share this post


Link to post
Share on other sites

Thanks guys..

that was sort of what I was thinking. I will see what i can make work

Share this post


Link to post
Share on other sites

I need to make the same thing for PACs and the PAC only runs one application so it will have to replace itself (because no network interface will be available - the new app will be transfered on a serial link).

I thought I had seen a framework for this somewhere on ni.com earlier, but I cannot find it now.

On the PAC it should be rather simple though. All this functionality has to do is to pick up the new file(s) once it shows up (or it is asked to), move them to their proper location (replacing the old executable etc.) - and then do a soft restart of the device (it does get a bit more complicated if such a restart is not permissible though; then the main app will have to be a dynamic launcher that graciously jumps from the old to the new code without interruption). The part that transfers the file is a separate issue.

Share this post


Link to post
Share on other sites

I need to make the same thing for PACs and the PAC only runs one application so it will have to replace itself (because no network interface will be available - the new app will be transfered on a serial link).

I thought I had seen a framework for this somewhere on ni.com earlier, but I cannot find it now.

On the PAC it should be rather simple though. All this functionality has to do is to pick up the new file(s) once it shows up (or it is asked to), move them to their proper location (replacing the old executable etc.) - and then do a soft restart of the device (it does get a bit more complicated if such a restart is not permissible though; then the main app will have to be a dynamic launcher that graciously jumps from the old to the new code without interruption). The part that transfers the file is a separate issue.

Is the framework you remember maybe RT System Replication? If so this is not for the application on the RT system to replace itself, but to push down an update from a host application to the (running) RT system. And honestly I don't think you want to have an RT system poll some remote location and attempt to replace itself with a new version. Imagine the system crashing somehow because the new version is not operational. And that system being at the other end of the world. You do want someone to take responsibility when the running app is replaced and be ready to take action if things go wrong.

Share this post


Link to post
Share on other sites

No, I'm not thinking about the System Replication software.

In our case the PAC will be typically be a few thousand meters subsea so it is definitely risky. The startup executable needs to be a bootstrapper which will unload and load the main code dynamically. That way we can ensure that we get another chance if the new software fails...

Is the framework you remember maybe RT System Replication? If so this is not for the application on the RT system to replace itself, but to push down an update from a host application to the (running) RT system. And honestly I don't think you want to have an RT system poll some remote location and attempt to replace itself with a new version. Imagine the system crashing somehow because the new version is not operational. And that system being at the other end of the world. You do want someone to take responsibility when the running app is replaced and be ready to take action if things go wrong.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.