Monit is free and open source software that helps you keep track of processes. It can restart services that are not responding or that have crashed. You can use Systemd or daemontools for the same purpose. In this article, we'll show you how to install and configure monit to control processes on Debian or Ubuntu Linux.


    for Centos 7-8

    To install, run the command on the server:

    yum install epel-release
    yum update
    yum install monit
    systemctl enable monit
    systemctl start monit
    for Debian-like system:

    To install, run the command on the server:

    sudo apt install monit

    Recommended configuration file /etc/monit/monitrc:

    set daemon 1
      with start delay 1
    set logfile /var/log/monit.log
    set idfile /var/lib/monit/id
    set statefile /var/lib/monit/state
    set httpd port 2812 and
      use address localhost
      allow localhost
    include /etc/monit/conf.d/*
    Configuration file for Astra service


    check process astra with pidfile /var/run/
        start program = "/etc/init.d/astra start"
        stop program = "/etc/init.d/astra stop"


    Configuration file for simple Astra process


    check process with pidfile /var/run/
        start program = "/bin/sh -c 'ulimit -n 65536;  /usr/bin/astra -c /etc/astra/astra.conf -p 8000 --pid /var/run/ --log /var/log/astra.log --daemon'"
        stop program = "/bin/sh -c 'kill `cat /var/run/`'"

    Restart monit to apply changes:

    systemctl restart monit


    sudo /etc/init.d/monit restart


    monit reload — reload configuration files
    monit summary — short information
    monit start astra — start Astra
    monit stop astra — stop Astra
    monit restart astra — restart Astra