svcMonitor

Started by capsx, April 22, 2016, 07:03:44 PM

Previous topic - Next topic

capsx


svcMonitor is not restarting services ...


[root@web:~]# service postfix status
master (pid  22024) is running...

[root@web:~]# service postfix stop
Shutting down postfix:                                     [  OK  ]

[root@web:~]# /usr/local/bin/svcMonitor

[root@web:~]# service postfix status
master is stopped


[root@web:~]# cat /usr/local/bin/svcMonitor
#!/bin/bash
export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin
for i in `cat /usr/local/etc/services-monitor`
do
service $i status 1> /dev/null
  if [ $? -eq 1 ]
  then
    echo Restarted service $i on `hostname` at `date`
    service $i restart
  fi
done

[root@web:~]# cat /usr/local/etc/services-monitor
crond
httpd
mysqld
postfix
pure-ftpd
sshd

capsx

ah:

0 program is running or service is OK
1 program is dead and /var/run pid file exists
2 program is dead and /var/lock lock file exists
3 program is not running
4 program or service status is unknown

svcMonitor is checking only - 1 program is dead and /var/run pid file exists

Administrator

version 0.9.8.15 will have this fixed.