We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

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

"watcher" service to check service status

Hello,

Does advanced installer have a feature in which i can create a "watcher" type of service that will start my main service if it stops?

Currently we install our application as a windows service and have set the recovery options to restart the service if it fails but we've noticed that it doesn't always restart. We have to restart it manually.

Is there any function/setting in AI that could help achieve something like this? Or, would we need to create an additional exe file to do this and install it alongside our main service?

Thanks
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: "watcher" service to check service status

Hello Phil,

Unfortunately, I am afraid that Advanced Installer does not offer such an option.

Depending on your needs, there may be two solutions here:

- if you need to check if the service is started (and if not, start it) during the whole time a user is logged on, then indeed the approach here would be to have an extra executable that also runs as a service, as you have mentioned.

- if you need to do the check only once (for instance, when the user logs in), this can also be achieved through a Scheduled Task. For instance, this scheduled task could be configured to run, when the user logs in, a batch file that checks if the service is started and, if not, start it.

Also, in what regards your other issue, please accept my apologies for the delay in reply. We had some National days off (due to Orthodox Easter). I will start looking into that soon (also, I have already downloaded the files).

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: "watcher" service to check service status

Hi Catalin.

Thanks for getting back to me.

The service runs in the background whether someone is logged on or not, but we've noticed it fail a few times. sometimes we don't know until after an hour or so when we stop seeing performance data coming in. This is something we'd want to run in the background - just in case someone isn't logged in.

I suspected it would be either an additional exe file or scheduled task, i think we could probably do this with some PowerShell and update the scheduled task we install to update local config files. I could set it to check the state and start it if its not running.

Thanks for clarifying Catalin,

Also regarding my other issue, no problem at all. I'm UK based so our Easter Holiday was the week before :)
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: "watcher" service to check service status

You are always welcome Phil!

In what regards this:
I suspected it would be either an additional exe file or scheduled task, i think we could probably do this with some PowerShell and update the scheduled task we install to update local config files. I could set it to check the state and start it if its not running.
To be fully honest with you, I would probably go for a .BAT file approach instead of a PowerShell script. There are two reasons for this:

1. what the file itself does is not that big of a deal. It can be done pretty easily from a .BAT file as well (perhaps using the sc.exe built-in tool)

2. with a PowerShell script, you may face issues in what regards the machine policies. I remember having quite some troubles with these policies, especially when I had to help users developing "PowerShell Script from file" type of custom actions.

I have to admit I am not quite familiar with running a PowerShell script as a scheduled task, but I just wanted to let you know about this. I believe you can maybe configure the scheduled task to run with the highest privileges and this problem will be avoided.

Also, you can find more information about the PowerShell execution policies here:

About Execution Policies

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

Return to “Building Installers”