Subversion Repositories ALCASAR

Rev

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

Rev 2574 Rev 2583
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
# $Id: alcasar-daemon.sh 2574 2018-07-20 21:27:51Z rexy $
2
# $Id: alcasar-daemon.sh 2583 2018-07-27 10:01:29Z 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
Line 10... Line 10...
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
LDAP=`grep ^LDAP= $conf_file|cut -d"=" -f2`				# ldap active (on/off)
13
LDAP=`grep ^LDAP= $conf_file|cut -d"=" -f2`				# ldap active (on/off)
14
LDAP=${LDAP:=off}
14
LDAP=${LDAP:=off}
-
 
15
INTIF=`grep ^INTIF= $conf_file|cut -d"=" -f2`				# INTIF name
-
 
16
EXTIF=`grep ^EXTIF= $conf_file|cut -d"=" -f2`				# EXTIF name
15
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"
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"
16
nb_available_srv=`echo $SERVICES|wc -w`
18
nb_available_srv=`echo $SERVICES|wc -w`
17
 
19
 
18
function ServiceTest () {
20
function ServiceTest () {
19
	CMD=`/usr/bin/systemctl is-active $s`
21
	CMD=`/usr/bin/systemctl is-active $s`
Line 25... Line 27...
25
	else
27
	else
26
		nb_srv=$((nb_srv+1))
28
		nb_srv=$((nb_srv+1))
27
	fi
29
	fi
28
}
30
}
29
 
31
 
-
 
32
for NIC in $EXTIF $INTIF
-
 
33
do
-
 
34
	if [ `/usr/sbin/ip a show $NIC|grep DOWN|wc -l` -eq "1" ]
-
 
35
	then
-
 
36
		echo "The network interface card '$NIC' is down! Try to enable it"
-
 
37
		/usr/sbin/ifup $NIC
-
 
38
	fi
-
 
39
done
-
 
40
 
30
nb_srv=0
41
nb_srv=0
31
for s in $SERVICES
42
for s in $SERVICES
32
do
43
do
33
	if [ $s != "sshd" ]
44
	if [ $s != "sshd" ]
34
	then
45
	then
Line 65... Line 76...
65
	then
76
	then
66
	echo "Enable LDAP..."
77
	echo "Enable LDAP..."
67
	/usr/local/bin/alcasar-ldap.sh -on
78
	/usr/local/bin/alcasar-ldap.sh -on
68
	fi
79
	fi
69
fi
80
fi
-
 
81