philb1208
Posts: 44
Joined: Thu Jul 04, 2019 3:24 pm

Config file updates (not application updates)

Hi,

My application installs a windows service which grabs a configuration file from a central location which is a directory on a linux web server. When the installer runs it downloads this file and copies it to program data where its passed to my service.

What i would like to do is make my installer so that it can check for any changes to this file, and if the file has been updated then download the new version and replace the old one.

I know i could create an updater, but the config files are likely to change on the fly so it would be better if my installer could periodically check the web server for any new configs, say every 2 hours or so. I'll be editing these config files on the server directly.

As mentioned, i think i could use the updater but i am unsure if i can include two updaters in my package?

My plan is to configure an updater for my application and run this as a service (we need a silent update process) - I can configure this to run when someone logs in.

Could i add a second updater as a service that would check the same directory every 2 hours and download the new config if it has changed?

Thanks.

Phil
Catalin
Posts: 6598
Joined: Wed Jun 13, 2018 7:49 am

Re: Config file updates (not application updates)

Hello Phil,
As mentioned, i think i could use the updater but i am unsure if i can include two updaters in my package?
I am afraid that it is not possible to have two updaters in a project.

However, I was thinking of another way in this can be achieved - through a Scheduled Task.

For instance, your setup can create a scheduled task which can call a script (e.g. PowerShell script, .bat file, etc.) - which will check on the web server to see whether the config file was updated or not - every two hours, indefinitely.

More information about our predefined support for scheduled tasks can be found in our "Scheduled Tasks Page" article.

Unfortunately, we do not support all the options that the Task Scheduler is offering. However, if our predefined support does not cover something, it can be achieved through a custom action.

For instance, the above scenario, where a scheduled task runs a script every two hours, indefinitely is not possible through our predefined support, because you can not specify indefinitely as input for our "Repeat task every:" functionality:

However, as mentioned above, this can be achieved through a custom action. For instance, a PowerShell script which would create the scheduled task mentioned above (one that runs a .BAT file every two hours, indefinitely) would look as it follows:

Code: Select all

$action = New-ScheduledTaskAction -Execute "C:\Users\Catalin\Desktop\hello.bat"
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 120)
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "TestTask" -Description "This is a test task. Its job is to start hello.bat every 120 minutes."
This can be implemented in your Advanced Installer project through our "Run Inline PowerShell script" predefined custom action.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
philb1208
Posts: 44
Joined: Thu Jul 04, 2019 3:24 pm

Re: Config file updates (not application updates)

HI Catalin,

Thanks for getting back to me!

We were using samba shares and a UNC path before which worked but we ran in to some security issues so have abandonned the samba idea. I'm not expecting the configs to change constantly, maybe once or twice a month if that. I just want to avoid having to download the new ones manually and restarting the service. I think a bat file/power shell script would work for me. I'll give this a try.

Thanks,

Phlil
Catalin
Posts: 6598
Joined: Wed Jun 13, 2018 7:49 am

Re: Config file updates (not application updates)

You are always welcome, Phil.

Glad I could help.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”