Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Self Updating

Tags:

patch

updating

What's the best way to terminate a program and then run additional code from the program that's being terminated? For example, what would be the best way for a program to self update itself?

like image 711
Mike Avatar asked Sep 05 '08 15:09

Mike


2 Answers

You have a couple options:

You could use another application .exe to do the auto update. This is probably the best method.

You can also rename a program's exe while it is running. Hence allowing you to get the file from some update server and replace it. On the program's next startup it will be using the new .exe. You can then delete the renamed file on startup.

like image 180
Brian R. Bondy Avatar answered Sep 30 '22 12:09

Brian R. Bondy


It'd be really helpful to know what language we're talking about here. I'm sure I could give you some really great tips for doing this in PowerBuilder or Cobol, but that might not really be what you're after! If you're talking Java however, then you could use a shut down hook - works great for me.

like image 37
ninesided Avatar answered Sep 30 '22 13:09

ninesided