Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSI install sequence - run DB scripts before services start

Folks,

we're running into some sequencing troubles with our MSI install. As part of our app, we install a bunch of services and allow the user to pick whether to start them right away or later.

When they start right away, they seem to start too early in the install sequence - before our database manager had a chance to update the database.

Right now, our custom action to run the database updater looks like this - it's being run after "InstallFinalize" - very late in the process.

   <InstallExecuteSequence>
      <RemoveExistingProducts After='InstallInitialize' />
      <Custom Action='RunDbUpdateManagerAction' After='InstallFinalize'>
           DbUpdateManager=3</Custom>
   </InstallExecuteSequence>

What would be the more appropriate step to run after or before, to make sure the DB scripts are executed before any of the installed services start up? Is there a "BeforeServiceStart" step?

EDIT:

Just defining the "Before='StartServices'" attribute on the tag didn't solve my problem.

I am assuming the issue is this: the custom action has an "inner text", which represents a condition, and this condition is: "&DbUpdateManager=3". From what I can deduce from trial & error, this probably means "the DbUpdateManager feature must be published".

Now, trouble is: "PublishFeature" comes way at the end in the install sequence, just before "InstallFinalize", and definitely AFTER InstallServices / StartServices. So when I specify the "Before=StartServices" requirement, the condition "DbUpdateManager feature must be published" isn't true yet, so the DbUpdateManager doesn't get executed :-(

I tried removing the condition - in that case, my DbUpdateManager sometimes doesn't execute at all, sometimes more than once - no real clear pattern as to what happens when.....

Any more ideas?? Is there a way I could check for a condition "the DbUpdateManager feature is installed" which would be true after the "InstallFiles" step??

Marc

like image 383
marc_s Avatar asked Apr 08 '26 17:04

marc_s


1 Answers

There is no BeforeServiceStart, but you could try Before='StartServices'.

like image 165
Anton Tykhyy Avatar answered Apr 12 '26 06:04

Anton Tykhyy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!