Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2966 → Rev 2967

/scripts/alcasar-daemon.sh
5,6 → 5,7
# by Franck BOUIJOUX & Rexy
# This script is distributed under the Gnu General Public License (GPL)
# Watchdog of Services
# With the option "-after-update" checks if services or system need to be restarted after a RPM update
# See /etc/cron.d/alcasar-daemon-watchdog for config the time
 
conf_file="/usr/local/etc/alcasar.conf"
36,51 → 37,63
fi
}
 
for NIC in $EXTIF $INTIF
do
if [ `/usr/sbin/ip a show $NIC|grep DOWN|wc -l` -eq "1" ]
then
echo "The network interface card '$NIC' is down! Try to enable it"
/usr/sbin/ifup $NIC
fi
done
 
nb_srv=0
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
usage="Usage: alcasar-daemon.sh {-after-update}"
case $1 in
-\? | -h* | --h*)
echo "$usage"
exit 0
;;
-after-update)
# TODO : check precisely which processes should be restarted (reboot the system or restart alcasar processes)
# extract processes name : for i in `dnf needs-restarting|cut -d " " -f3|sort -u|tr -d ":"|rev|cut -d"/" -f1|rev`;do;echo $i;done
# system_processes=`dnf needs-restarting|egrep 'dbus|python|systemd|agetty'|wc -l` # processes to be restarted after glibc update
nb_processes=`dnf needs-restarting|wc -l`
if [ $nb_processes -ne 0 ]; then
reboot
fi
elif [ $service == 'gammu-smsd' ]; then
if [ $SMS != "ON" ] && [ $SMS != "on" ] && [ $SMS != "On" ]; then
nb_available_srv=$((nb_available_srv-1))
continue
;;
*)
for NIC in $EXTIF $INTIF
do
if [ `/usr/sbin/ip a show $NIC|grep DOWN|wc -l` -eq "1" ]; then
echo "The network interface card '$NIC' is down! Try to enable it"
/usr/sbin/ifup $NIC
fi
done
nb_srv=0
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 [ $SMS != "ON" ] && [ $SMS != "on" ] && [ $SMS != "On" ]; then
nb_available_srv=$((nb_available_srv-1))
continue
fi
fi
ServiceTest $service
done
if [ $nb_available_srv -ne $nb_srv ]; then
echo "Restart this script to know if all is ok"
else
echo "$nb_srv services needed by ALCASAR are started."
fi
fi
ServiceTest $service
done
 
if [ $nb_available_srv -ne $nb_srv ]
then
echo "Restart this script to know if all is ok"
else
echo "$nb_srv services needed by ALCASAR are started."
fi
 
if [ `cat /proc/modules|grep -c ^ipt_NETFLOW` == 0 ]
then
logger -t alcasar-daemon -i "ipt_netflow is inactive."
echo "The Log system is disabled! try to know why (modprobe ipt_NETFLOW)"
else
echo "The Log system is active"
fi
if [ ! -e /etc/raddb/mods-enabled/ldap ]
then
if [ $LDAP == "ON" ] || [ $LDAP == "on" ] || [ $LDAP == "On" ]
then
echo "Enabling LDAP..."
/usr/local/bin/alcasar-ldap.sh -on
fi
fi
 
if [ `cat /proc/modules|grep -c ^ipt_NETFLOW` == 0 ]; then
logger -t alcasar-daemon -i "ipt_netflow is inactive."
echo "The Log system is disabled! try to know why (modprobe ipt_NETFLOW)"
else
echo "The Log system is active"
fi
if [ ! -e /etc/raddb/mods-enabled/ldap ]; then
if [ $LDAP == "ON" ] || [ $LDAP == "on" ] || [ $LDAP == "On" ]; then
echo "Enabling LDAP..."
/usr/local/bin/alcasar-ldap.sh -on
fi
fi
;;
esac
/scripts/alcasar-watchdog.sh
119,15 → 119,15
-\? | -h* | --h*)
echo "$usage"
exit 0
;;
;;
-lt | --lan_test)
lan_test
exit 0
;;
;;
--disconnect-permanent-users)
/bin/sed -i '/PERM/d' $current_users_file
exit 0
;;
/bin/sed -i '/PERM/d' $current_users_file
exit 0
;;
*)
lan_test
# We disconnect inactive users (its means that their 'status.php' tab has been closed --> their ip address isn't in $current_users_file)
171,6 → 171,6
fi
fi
done
;;
;;
esac
IFS=$OLDIFS