How to use Linux software watchdog?

后端 未结 9 2230
星月不相逢
星月不相逢 2020-12-05 05:02

Can anybody tell me how to handle the software watchdog in Linux?

I have a program SampleApplication which runs continuously and I need to restart it if

相关标签:
9条回答
  • 2020-12-05 05:58

    You can use "Monit" utility to restart and monitor your services. Simply install by issuing command `"apt-get install monit".

    0 讨论(0)
  • 2020-12-05 05:58

    If anyone has arrived at this page looking for an operating system watchdog (which is not directly what the OP wanted), this is what you need:

    sudo apt-get install watchdog
    service watchdog status
    service watchdog start 
    

    To check that it's working execute:

    tail -f /var/log/syslog | grep watchdog
    

    You should see something like:

    Jul 25 22:03:35 nuc watchdog[14229]: still alive after 733 interval(s)
    Jul 25 22:03:36 nuc watchdog[14229]: still alive after 734 interval(s)
    Jul 25 22:03:36 nuc watchdog[14229]: still alive after 735 interval(s)
    Jul 25 22:03:37 nuc watchdog[14229]: still alive after 736 interval(s)
    Jul 25 22:03:37 nuc watchdog[14229]: still alive after 737 interval(s)
    

    I hope I'm answering the question correctly. All the other answers seem to be very different.

    0 讨论(0)
  • 2020-12-05 06:01

    Use /etc/inittab you can utilize it to start in the specific run levels and if it is killed it shall be restarted automatically

    n:2345:respawn:/path/to/app
    

    This will make it respawn in run levels 2345 you probably only need 3 and 5 but this will work fine and is built into Linux.

    0 讨论(0)
提交回复
热议问题