Creating an IsAlive Script

  • I may need to create a script similar in function to the "IsAlive" check on clustered servers - only to handle the condition where the server is non-responsive. For example, if "select @@servername" doesn't return results in xx-seconds, then an automated restart of the services would occur.

    I've done scripting before, but since I have the time, I'm thinking of plunging into PowerShell. Will this high-level approach work, as I also have never scripted "non-responding" before?

    1) Run sqlcmd with a QueryTimeout parameter (-t) for xx-seconds

    2) Hopefully, the sqlcmd timeout generates some sort of return code I can check, then NET STOP/START the agent and SQL Services

    3) Maybe even throw-in an email notification

    Not looking for any code to do this - that would take the fun out of it. Just some validation in what I want to do can be done.

    Thanks,

    Cindy

  • Yeah that would work, we have code that basically does the same thing.

  • Thanks. Just wanted to make sure I wasn't trying to write/learn something that couldn't be done. PowerShell - here I come!

    Cindy

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply