Application monitor

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dcrespo

    #1

    Application monitor

    Hi to all,

    I'd like to have an app monitor that gets rid of another app, in the
    way that if it closes unspectedly, the app monitor just wake it up one
    more time, and viceversa.

    I mean:

    Main application starts
    This one starts the App Monitor of itself. (This means that if Main
    Application closes, the App Monitor restart it)

    And viceversa means that if App Monitor closes, the Main application
    restart it.

    How can I accomplish this?

    I've been thinking in wx.SingleInstan ceChecker (from wxPython GUI
    library). If it doesn't exist, then call os.system(<prog ram_name>). But
    I don't know if there's a better way.

    Thanks

    Daniel

  • Mike Meyer

    #2
    Re: Application monitor

    "dcrespo" <dcrespo@gmail. com> writes:[color=blue]
    > Main application starts
    > This one starts the App Monitor of itself. (This means that if Main
    > Application closes, the App Monitor restart it)
    >
    > And viceversa means that if App Monitor closes, the Main application
    > restart it.
    >
    > How can I accomplish this?
    >
    > I've been thinking in wx.SingleInstan ceChecker (from wxPython GUI
    > library). If it doesn't exist, then call os.system(<prog ram_name>). But
    > I don't know if there's a better way.[/color]

    "Better" depends on what your requirements are. Personally, I use init
    as an app monitor. It doesn't need monitoring - if it's dead, your
    Unix has a lot worse problems than one application being down.

    <mike
    --
    Mike Meyer <mwm@mired.or g> http://www.mired.org/home/mwm/
    Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

    Comment

    • dcrespo

      #3
      Re: Application monitor

      > Personally, I use init[color=blue]
      > as an app monitor. It doesn't need monitoring[/color]

      What's "init"? Sorry about my ignorance.

      Comment

      • Mike Meyer

        #4
        Re: Application monitor

        "dcrespo" <dcrespo@gmail. com> writes:[color=blue][color=green]
        >> Personally, I use init as an app monitor. It doesn't need monitoring[/color]
        > What's "init"? Sorry about my ignorance.[/color]

        init is the first Unix process, and all other processes are descended
        from it. It is the alpha and the omega of Unix processes. Uh, wait a
        second - I'm having biblical flashes here. Let's try again:

        init is the first process started when a Unix system boots, and is
        hand crafted by the boot process. Every other process on the system is
        started by a fork (or a variant) system call, and are descendants of
        init. Part of it's job is starting the various server processes on the
        system that are appropriate for the system state. It notices when they
        exit, and restarts them. On timesharing systems, it will start a login
        process on every terminal, which would then exec it's way into a user
        shell, which would exit - which init would notice, and launch another
        login on that terminal. If init is dead, your Unix system is in a bad
        way.

        You can use this on modern Unix systems. You add an entry to init's
        config file (/etc/inittab on SysV-like systems, and /etc/ttys on
        BSD-derived systems), and init will launch a process for that
        entry. If the process ever exits, init will launch it again.

        For instance, I launch an ssh client to keep a couple of TCP tunnels
        open to my ISPs server so I can access services that aren't available
        from my current location. I run that via init. No need to worry about
        hardening the ssh client, or writing a wrapper around it, or anny such
        thing. init deals with all of that for me.

        <mike
        --
        Mike Meyer <mwm@mired.or g> http://www.mired.org/home/mwm/
        Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

        Comment

        • Magnus Lycka

          #5
          Re: Application monitor

          dcrespo wrote:[color=blue]
          > Hi to all,
          >
          > I'd like to have an app monitor that gets rid of another app, in the
          > way that if it closes unspectedly, the app monitor just wake it up one
          > more time, and viceversa.[/color]

          Twisted contains such a thing. I think it's called twisted.runner,
          and no, it's not just for keeping Twisted processes running.

          Comment

          • Daniel Crespo

            #6
            Re: Application monitor

            Many thanks for your answers.

            Respect Init, I need a cross platform solution. Most of times my system
            will run in Win98 and XP (more on XP than 98)

            Respect Twisted... Mmm... I already started with another networking
            library (TCPServer and SimpleXMLRPCSer ver), and I wouldn't like to mix
            things because I don't know so much about those libraries. I know that
            Twisted can do what I already have. But replacing it can be a hard
            task. So I would like to have a function like FindPID(exename ) --> PID,
            or something more generic that could tell me the PID of a running
            program, and kill him in a certain moment.

            Daniel

            Comment

            • Magnus Lycka

              #7
              Re: Application monitor

              Daniel Crespo wrote:[color=blue]
              > Respect Twisted... Mmm... I already started with another networking
              > library (TCPServer and SimpleXMLRPCSer ver), and I wouldn't like to mix
              > things because I don't know so much about those libraries. I know that
              > Twisted can do what I already have. But replacing it can be a hard
              > task. So I would like to have a function like FindPID(exename ) --> PID,
              > or something more generic that could tell me the PID of a running
              > program, and kill him in a certain moment.[/color]

              You *could* use twisted.runner for process control even if you
              don't use twisted for your networking code. It does seem like
              a funny thing to do, but there's nothing stopping you from doing
              that. The example code in twisted.runner starts up a few shell
              scripts that die on their own accord, and make sure they get
              restarted, so it doesn't rely on twisted being used in the
              processes it controls.

              Comment

              • Daniel Crespo

                #8
                Re: Application monitor

                Magnus Lycka wrote:[color=blue]
                > You *could* use twisted.runner for process control even if you
                > don't use twisted for your networking code. It does seem like
                > a funny thing to do, but there's nothing stopping you from doing
                > that. The example code in twisted.runner starts up a few shell
                > scripts that die on their own accord, and make sure they get
                > restarted, so it doesn't rely on twisted being used in the
                > processes it controls.[/color]

                Ok. I'll take a look. Thank you very much! :)

                Daniel

                Comment

                Working...