delphi - Auto update a service -
i have written several services in delphi now, want add facility of auto updating service either lan unc path or http server. have been pondering , interested hear peoples ideas. can create thread check update periodically, how go stopping service uninstalling , installing automatically. initial thoughts write console app , start using create process, let service stop , console app work, starting new version of service before exits. stratergy or shoul consider else. in advance
i suggest. thread checks update. if present, downloads , puts appropriate place. verifies wholesome (don't want broken!). finally, thread launches app parameters tell do, specifically, name of service, location of file replace, , file replace with. service waits.
when updater app starts, pauses moment make sure service stable, , uses service control api stop service. monitors until gone. finally, pauses little ensure windows has finished file. starts process of renaming old file move out of way (if still in use, retries few times), , copying new file place. , finally, starts service again. updater quits.
this has worked quite reliably services, , standalone apps (with different parameters updater app know mode). , if careful, can update updater using exact same system, nice watch.
Comments
Post a Comment