Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-daemon.sh 2601 2018-08-19 23:58:27Z tom.houdayer $
|
2 |
# $Id: alcasar-daemon.sh 2620 2018-08-23 22:35:52Z rexy $
|
3 |
|
3 |
|
4 |
# alcasar-daemon.sh
|
4 |
# alcasar-daemon.sh
|
5 |
# by Franck BOUIJOUX & Rexy
|
5 |
# by Franck BOUIJOUX & Rexy
|
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"
|
10 |
conf_file="/usr/local/etc/alcasar.conf"
|
11 |
SSH=`grep ^SSH= $conf_file|cut -d"=" -f2` # sshd active (on/off)
|
11 |
SSH=`grep ^SSH= $conf_file|cut -d"=" -f2` # sshd active (on/off)
|
12 |
SSH=${SSH:=off}
|
12 |
SSH=${SSH:=off}
|
- |
|
13 |
SMS=`grep ^SMS= $conf_file|cut -d"=" -f2` # SMS active (on/off)
|
- |
|
14 |
SMS=${SMS:=off}
|
13 |
LDAP=`grep ^LDAP= $conf_file|cut -d"=" -f2` # ldap active (on/off)
|
15 |
LDAP=`grep ^LDAP= $conf_file|cut -d"=" -f2` # ldap active (on/off)
|
14 |
LDAP=${LDAP:=off}
|
16 |
LDAP=${LDAP:=off}
|
15 |
INTIF=`grep ^INTIF= $conf_file|cut -d"=" -f2` # INTIF name
|
17 |
INTIF=`grep ^INTIF= $conf_file|cut -d"=" -f2` # INTIF name
|
16 |
EXTIF=`grep ^EXTIF= $conf_file|cut -d"=" -f2` # EXTIF name
|
18 |
EXTIF=`grep ^EXTIF= $conf_file|cut -d"=" -f2` # EXTIF name
|
17 |
SERVICES="mysqld lighttpd php-fpm ntpd havp dnsmasq dnsmasq-blacklist dnsmasq-whitelist dnsmasq-blackhole radiusd tinyproxy nfsen e2guardian freshclam ulogd-ssh ulogd-traceability ulogd-ext-access chilli fail2ban sshd vnstat gammu-smsd"
|
19 |
SERVICES="mysqld lighttpd php-fpm ntpd havp dnsmasq dnsmasq-blacklist dnsmasq-whitelist dnsmasq-blackhole radiusd tinyproxy nfsen e2guardian freshclam ulogd-ssh ulogd-traceability ulogd-ext-access chilli fail2ban sshd vnstat gammu-smsd"
|
Line 43... |
Line 45... |
43 |
if [ $SSH != "ON" ] && [ $SSH != "on" ] && [ $SSH != "On" ]; then
|
45 |
if [ $SSH != "ON" ] && [ $SSH != "on" ] && [ $SSH != "On" ]; then
|
44 |
nb_available_srv=$((nb_available_srv-1))
|
46 |
nb_available_srv=$((nb_available_srv-1))
|
45 |
continue
|
47 |
continue
|
46 |
fi
|
48 |
fi
|
47 |
elif [ $service == 'gammu-smsd' ]; then
|
49 |
elif [ $service == 'gammu-smsd' ]; then
|
48 |
if [ $(grep '^SMS=' $conf_file | cut -d'=' -f2-) != 'on' ]; then
|
50 |
if [ $SMS != "ON" ] && [ $SMS != "on" ] && [ $SMS != "On" ]; then
|
49 |
nb_available_srv=$((nb_available_srv-1))
|
51 |
nb_available_srv=$((nb_available_srv-1))
|
50 |
continue
|
52 |
continue
|
51 |
fi
|
53 |
fi
|
52 |
fi
|
54 |
fi
|
53 |
|
- |
|
54 |
ServiceTest $service
|
55 |
ServiceTest $service
|
55 |
done
|
56 |
done
|
56 |
|
57 |
|
57 |
if [ $nb_available_srv -ne $nb_srv ]
|
58 |
if [ $nb_available_srv -ne $nb_srv ]
|
58 |
then
|
59 |
then
|