If this works - thanks Jim!
-----Original Message-----
From: Peter Mueller
Sent: Wednesday, May 15, 2002 11:59 AM
To: '[EMAIL PROTECTED]'
Subject: monitor a pid?
hi,
newbie question. how does everyone here recommend monitoring a pid? I was
playing around with this a _while_ back and I could never get it to work..
my PID heartbeat just seems to restart endlessly!. help help plz :)
Peter
mon version = mon-0.99.2
<mon errfile log>
[root@fe4028 mon]# cat errfile
/usr/src/mon/alert.d/heartbeat.alert: [: =: unary operator expected
Stopping High-Availability services: [ OK ]
/usr/src/mon/alert.d/heartbeat.alert: [: =: unary operator expected
Stopping High-Availability services: [ OK ]
/usr/src/mon/alert.d/heartbeat.alert: [: =: unary operator expected
Stopping High-Availability services: [ OK ]
/usr/src/mon/alert.d/heartbeat.alert: [: =: unary operator expected
Stopping High-Availability services: [ OK ]
/usr/src/mon/alert.d/heartbeat.alert: [: =: unary operator expected
<part of mon.cf>
watch heartbeat
service heartbeat
interval 15s
monitor pid.monitor heartbeat
depend gateway:fping
dep_behavior m
period NORMAL: wd {Sun-Sat}
alert restart.alert heartbeat
<pid.monitor>
#!/bin/sh
# Script for mon to check wether a process is running or not.
# Invoke with
# monitor pid.monitor process
/sbin/pidof -s $1 > /dev/null 2>&1
if [ $? -eq "0" ]; then
echo "$1 running"
exit 0
else
echo "$1 not running"
exit 1
fi
<restart.alert>
#!/bin/bash
# Script to start/stop heartbeat daemon
HEARTBEAT="/etc/rc.d/init.d/heartbeat"
if [ $9 = "-u" ]; then
$HEARTBEAT restart
else
$HEARTBEAT stop
fi