9

So I suck at scripts, windows scripts namely. I need a script to monitor a program on machine and send an email if it goes down. There are eight instances running on the machine and they can be determined to be working if a specific port is open, one port per instance. I have no clue where to start and I thought it could be done with some existing service or script. Suggestions?

Comments
  • 0
    Or if someone could tell me what I'd need to right such a script. All I know is nmap will be helpful.
  • 0
    @azuredivay that's the thing. Idk. Im a noob but I'm trying to learn.
  • 0
    Just to subscribe
  • 1
    The port idea sounds messy. Why dont all programms get an onClose property and log their closure into a file
  • 1
    @linuxer4fun or the programms log their activity every minute into a file and if one hasnt logged, it crashed
  • 1
    @CCTrollz - you might be better off doing the email handling in python.

    This would be my approach:

    1. Startup "Scheduled Tasks" - add a task and set to run every 5 minutes.

    2. Set the scheduled task to run "scan-ports-and-email.py"

    You should be able to find a python mailing script and a port scan script to glue together for the above to work.
  • 1
    @kunashe @linuxer4fun thanks both of you for help. The port scan idea came about so the script could be run locally or externaly.
  • 0
    I think you are better off writing a daemon than just using a script
  • 0
    @magnusi lol, I am monitoring the status of some clients running on a daemon. So my daemon would watch my other daemon for me.
  • 0
    @CCTrollz daemon-ception? why not? 😀
Add Comment