Score:0

How to restart a windows service when a log file has not been modified for a period of time?

py flag

I have a windows service and it's running a bit problematic. Sometimes it crashes or sometimes connection to the server is lost but it does nothing for it. Therefore, I have to check the logs of the service (log names change every day, like the date of that day) and restart the service with PowerShell scripts if it doesn't change in a while (eg 1 minute). How can I do this with PowerShell scripts.

my flag
What have you tried so far?
GetShifting avatar
lk flag
An easy fix for the crashes could be to take a look at the recovery options for the service. This allows you to take automatic actions when the service crashes. You can find this in the eventlog afterwards as event 7031.
oktay avatar
py flag
Crash is not correct word for the situation, it seems running but it not operate. So if service not write log i can understand it not work and need restart.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.