Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 823 → Rev 824

/scripts/sbin/alcasar-daemon.sh
1,22 → 1,39
#!/bin/sh
# $Id: alcasar-bl.sh 412 2011-01-03 21:40:09Z richard $
# $Id:$
 
# alcasar-watchdog.sh
# alcasar-daemon.sh
# by Franck BOUIJOUX
# This script is distributed under the Gnu General Public License (GPL)
# Watchdog of Services
# See /etc/cron.d/alcasar-daemon-watchdog for config the time
 
conf_file="/usr/local/etc/alcasar.conf"
SSH=`grep SSH= $conf_file|cut -d"=" -f2` # sshd active (on/off)
SSH=${SSH:=off}
SERVICE="sshd dnsmasq httpd chilli radiusd mysqld dansguardian dnsmasq havp freshclam ntpd squid master squid"
 
SERVICE="httpd chilli radiusd mysqld dansguardian dnsmasq havp ntpd squid master"
function ServiceTest () {
CMD=`pidof $s`
if [ -z "$CMD" ]
then
service $s restart
# else
# echo "Service $s is On on PID : $CMD"
fi
}
 
 
for s in $SERVICE
do
CMD=`pidof $s`
if [ -z "$CMD" ]
if [ $s != "sshd" ]
then
service $s restart
else
echo "Service $s is On on PID : $CMD"
ServiceTest ($s)
else
{
if [ $SSH == "ON" ] | [ $SSH == "on" ] | [ $SSH == "On" ]
then
ServiceTest ($s)
fi
}
fi
done