monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Error reading pid from file


From: Ron Eggler
Subject: Error reading pid from file
Date: Mon, 21 Sep 2020 16:05:52 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

Hi All,

I'm new here and also new to Monit.
I wrote a script that I would like to have invoked once an hour by monit.

I have added the following to my /etc/monit/monitrc:

cat /etc/monit/monitrc
set daemon 30
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set eventqueue
      basedir /var/lib/monit/events # set the base directory where events will be stored
      slots 100                     # optionally limit the queue size

check ping.sh
    with path "/path/to/ping.sh"
    every "44 * * * *"
    #if status != 0 then alert


and I got the following in /var/log/monit.log:

[UTC Sep 21 22:25:38] info     : Starting Monit 5.16 daemon
[UTC Sep 21 22:25:38] info     : '056e2c2' Monit 5.16 started
[UTC Sep 21 22:44:09] error    : Error reading pid from file '/path/to/ping.sh'
[UTC Sep 21 22:44:09] error    : 'ping.sh' process is not running
[UTC Sep 21 22:44:09] info     : 'ping.sh' trying to restart

while:

ls -l /path/to/ping.sh
-rwxrwxr-x 1 root root 1045 Sep 21 20:08 /path/to/ping.sh

and inside the script, the pid is stored in /var/run/ping.pid:

#!/bin/bash
pidfile="/var/run/ping.pid"
# Get the pid of the currently running script
ps ax | grep $0 | grep $SHELL | awk '{print $1}'>$pidfile


the pid file is deleted on the bottom of the script with:

rm $pidfile


why is there an error: "Error reading pid from file '/path/to/ping.sh'"?


Thank you, Ron




reply via email to

[Prev in Thread] Current Thread [Next in Thread]