update the executable of my application via FTP

update the executable of my application via FTP

Postby MGA » Tue Jun 13, 2017 2:46 am

Friends,

would someone have an example of how to create a routine to update the executable of my application via FTP?
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: update the executable of my application via FTP

Postby Marc Venken » Tue Jun 13, 2017 7:31 am

I do this :

I have a global parameter table where I have a field : version. This field is the last released version.
I have a users database, where every user has his own field version :

I check the users version with the global version and when there is a difference, I copy the file from the server to his local machine :
Code: Select all  Expand view
  // versie update controle
   if oRs:versie <> system_version
     if URLDOWNLOADTOFILE( 0, "http:\\http://www.yoursite.com/fivewin/program.exe", "update.exe" ) = 0
        oRs:versie = system_version
        oRs:Save()
        msginfo("Update gevonden")
     endif
   endif

You need this DLL function :

DLL FUNCTION URLDOWNLOADTOFILE( pCaller AS LONG, cUrl AS LPSTR, cFileName AS LPSTR, nReserved AS DWORD, nFnCB AS LONG ) AS LONG;
    PASCAL FROM "URLDownloadToFileA" LIB "urlmon.dll"

 


It will copy the exe file as a Update.exe file to the local machine, since I was not able to copy the file as the original exe file, since the original file is allready loaded into the computer.

The users start the program with a batch file : start.bat with the folowing code.
If there is a update.exe the new version will be copy over the old version.

copy update.exe kabouters.exe
erase update.exe
start kabouters.exe
exit 0

I'm sure there are better ways, but this works. Maybe a better solution will come in this treat and can I addapt :wink:
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1426
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: update the executable of my application via FTP

Postby Gale FORd » Tue Jun 13, 2017 2:42 pm

I am using TUpdate class and it works pretty good. I am using a modified version but the original works ok.
I think someone posted the code here:
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=32310&p=189530&hilit=tupdate#p189530
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: update the executable of my application via FTP

Postby MGA » Wed Jun 14, 2017 11:32 am

Marc Venken, Thanks!

Gale FORd thanks!
:D
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: update the executable of my application via FTP

Postby Carlos Mora » Fri Jun 16, 2017 4:49 pm

SGS wrote:would someone have an example of how to create a routine to update the executable of my application via FTP?


There is a very good post of Byel about this topic that is worth to read.

http://bielsys.blogspot.com.es/2009/02/

It is in spanish, but you'll be able to read it with Google translator.

Regards
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: update the executable of my application via FTP

Postby TimStone » Fri Jun 16, 2017 5:13 pm

Sorry to weigh in late on this. I not only had the need to auto install updates, but I also wanted to do backups everynight of all the data on the machine, and submit data for 3rd party vendors used by the clients.

I built an "AutoUpdate" executable on the primary machine. Every 3 hours it queries our server to see if there is an update. It also downloads a "keyfile" from our server which has a file ( encrypted ) of clients, and their version authorizations. I also have a rental program, so it contains the shut off date it payments are not received ( or the new extended authorization date when they are ). In the middle of the night ( after midnight ) when people are not likely on the system, it creates a backup archive file ( zip ) which it saves to a specified destination ( usually an external drive ), and it submits data to those vendors. Finally, it also sends emails to clients based on settings in the system ( especially thank you notes and reminders ).

When a new update is available, it does have the same name as the client executable, but it is downloaded to a sub folder on the primary (server) computer. When a person starts the client on their workstation, it actually calls a "run" program which checks for new copies of the .exe and .chm files on the server, and copies them to the local machine. Then it starts the client executable.

This system has been in place for many years, and it works beautifully. Sometimes when adding a new capability to the software, it can take a few "fine tuning" updates ... and of course if there is an error, it can be fixed and made available immediately.

The auto updater runs 24/7 and right clicking on the icon will bring up a menu where the log can be displayed, and also a person can do an immediate update request. So, in our "real world" if someone finds a bug that interferes with their operations, calls it in at 8:00 am, by 8:10 it is fixed, a new .exe is built and pushed to the server, and they can manually request an update. Thus, they can be running bug free by 8:15. Since most bugs are typos, fixes are usually very fast, and this operation is very easy.

The actual code is rather simple ... just write it to generally avoid any screen displays so it is fast and efficient.

I've tried to build this as a windows service, and so far have not been successful. I believe it will happen in the near future, however, once I determine which library elements ( unused but present ) are blocking that ability.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: update the executable of my application via FTP

Postby Marc Venken » Fri Jun 16, 2017 8:13 pm

it actually calls a "run" program which checks for new copies of the .exe and .chm files on the server, and copies them to the local machine. Then it starts the client executable.


Is this a exe file running, looking for the update, copy if needed and than calling you exe file ?

I use a bat file like above, but it has that annoying black old screen.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1426
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: update the executable of my application via FTP

Postby TimStone » Fri Jun 16, 2017 9:10 pm

Yes, it is an .exe that I created. It has more intelligence than a bat file ....
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: update the executable of my application via FTP

Postby Marc Venken » Fri Jun 16, 2017 9:41 pm

So, Your Run program on every client will call afther the update/copy the new version to launch. I suppose with a waitrun or so ?
But the Run program will also be running 24/7 or when do you close this?

What happens if the client closes your 24/7 update program. Your backup system will fail not ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1426
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: update the executable of my application via FTP

Postby TimStone » Fri Jun 16, 2017 10:59 pm

Marc,

The program on the server runs 24/7. If they turn it off, it obviously cannot work. However, when they turn it back on, it "catches up".

The desktop icon on the workstation points to the local update program. When someone exits the program, then restarts it, that is when it checks the server to see if there is a more recent copy of the main executable. If so, it copies it over. It also does the same with other files it checks for updated versions. Then it starts the program. This usually just takes a few seconds. Our clients do not keep the programs running when they leave at the end of the workday.

The bottom line is it works VERY WELL.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: update the executable of my application via FTP

Postby MGA » Mon Jun 19, 2017 12:33 pm

Carlos Mora,

Worked perfectly, thank you!
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: update the executable of my application via FTP

Postby Marc Venken » Mon Jun 19, 2017 1:01 pm

SGS wrote:Carlos Mora,

Worked perfectly, thank you!


I did not look yet. Is in spanisch :!: Will use Google to translate, but did it worked like it is posted, or did you have to make extra changes ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1426
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: update the executable of my application via FTP

Postby MGA » Mon Jun 19, 2017 6:54 pm

Marc Venken,

http://bielsys.blogspot.com.es/2009/02/

Worked perfectly, I made some adjustments just to fit my specific needs. The original source code works perfectly.
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 59 guests