Application process monitoring under Linux

Two ideas:

First, execute the monitoring script regularly

   Use the crontab that comes with centos to execute the status.sh script regularly as needed.

  #!/bin/bash

  status=$(ps -aux | grep “rsync –daemon” | grep -v “grep” | wc -l)

  if [ $status -eq 0 ];then em>

    systemctl restart rsyncd.service
  else
    exit 0;
  fi

Second, the way of background execution

  sh status.sh &

  #!/bin/bash

  while true

  do

    ps -aux | grep “rsync –daemon” | grep -v “grep” | wc -l
    if [$? -ne 0 ]; then
      systemctl restart rsyncd.service
    fi
    sleep 10
  done

The current general idea is these two Kind, if you have other ideas, please leave a message to discuss!

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5091 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.