Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2600 → Rev 2601

/scripts/alcasar-daemon.sh
1,4 → 1,4
#!/bin/sh
#!/bin/bash
# $Id$
 
# alcasar-daemon.sh
14,16 → 14,15
LDAP=${LDAP:=off}
INTIF=`grep ^INTIF= $conf_file|cut -d"=" -f2` # INTIF name
EXTIF=`grep ^EXTIF= $conf_file|cut -d"=" -f2` # EXTIF name
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"
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"
nb_available_srv=`echo $SERVICES|wc -w`
 
function ServiceTest () {
CMD=`/usr/bin/systemctl is-active $s`
if [ $CMD != "active" ]
then
logger -t alcasar-daemon -i "$s is inactive. Activation attempt"
echo "the $s service is disabled! trying to start it..."
/usr/bin/systemctl start $s.service
service=$1
if [ $(/usr/bin/systemctl is-active $service) != "active" ]; then
logger -t alcasar-daemon -i "$service is inactive. Activation attempt"
echo "the $service service is disabled! trying to start it..."
/usr/bin/systemctl start $service.service
else
nb_srv=$((nb_srv+1))
fi
39,21 → 38,20
done
 
nb_srv=0
for s in $SERVICES
do
if [ $s != "sshd" ]
then
ServiceTest
else
{
if [ $SSH == "ON" ] || [ $SSH == "on" ] || [ $SSH == "On" ]
then
ServiceTest
else
for service in $SERVICES; do
if [ $service == 'sshd' ]; then
if [ $SSH != "ON" ] && [ $SSH != "on" ] && [ $SSH != "On" ]; then
nb_available_srv=$((nb_available_srv-1))
continue
fi
}
elif [ $service == 'gammu-smsd' ]; then
if [ $(grep '^SMS=' $conf_file | cut -d'=' -f2-) != 'on' ]; then
nb_available_srv=$((nb_available_srv-1))
continue
fi
fi
 
ServiceTest $service
done
 
if [ $nb_available_srv -ne $nb_srv ]