Subversion Repositories ALCASAR

Rev

Rev 807 | Rev 825 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 807 Rev 824
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
# $Id: alcasar-bl.sh 412 2011-01-03 21:40:09Z richard $
2
# $Id:$
3
 
3
 
4
# alcasar-watchdog.sh
4
# alcasar-daemon.sh
5
# by Franck BOUIJOUX
5
# by Franck BOUIJOUX
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
# Watchdog of Services
7
# Watchdog of Services
8
# See /etc/cron.d/alcasar-daemon-watchdog for config the time
8
# See /etc/cron.d/alcasar-daemon-watchdog for config the time
9
 
9
 
-
 
10
conf_file="/usr/local/etc/alcasar.conf"
-
 
11
SSH=`grep SSH= $conf_file|cut -d"=" -f2`				# sshd active (on/off)
-
 
12
SSH=${SSH:=off}
-
 
13
SERVICE="sshd dnsmasq httpd chilli radiusd mysqld dansguardian dnsmasq havp freshclam ntpd squid master squid"
-
 
14
 
-
 
15
function ServiceTest () {
-
 
16
	 CMD=`pidof $s`
-
 
17
	 if [ -z "$CMD" ]
-
 
18
	 then
-
 
19
	    service $s restart
-
 
20
#	 else
-
 
21
#	    echo "Service $s is On on PID : $CMD"
-
 
22
	 fi
-
 
23
}
10
 
24
 
11
SERVICE="httpd chilli radiusd mysqld dansguardian dnsmasq havp ntpd squid master"
-
 
12
 
25
 
13
for s in $SERVICE
26
for s in $SERVICE
14
do
27
do
15
	CMD=`pidof $s`
-
 
16
	if [ -z "$CMD" ]
28
	if [ $s != "sshd" ] 
17
	then
29
	then
18
		service $s restart
30
	    ServiceTest ($s)
19
	else	
31
	else
-
 
32
	{
-
 
33
	    if [ $SSH == "ON" ] | [ $SSH == "on" ] | [ $SSH == "On" ]
-
 
34
	    then
20
		echo "Service $s is On on PID : $CMD"
35
		  ServiceTest ($s)
-
 
36
	    fi
-
 
37
	}
21
	fi
38
	fi
22
done
39
done