diff --git a/upgradeAll.sh b/upgradeAll.sh index 671856c11dc9a0a79143bee25c2ec90ba2a87ba9..b310d21a731a827af447f20923c932cd0240228a 100644 --- a/upgradeAll.sh +++ b/upgradeAll.sh @@ -54,14 +54,22 @@ fi # install monit if not installed if [ -z "$(dpkg -l | grep ' monit ')" ]; then apt-get update && apt-get install -y monit - echo -e 'check device root with path /\n if SPACE usage > 75% then alert\n\ncheck device home with path /home\n if SPACE usage > 75% then alert' > /etc/monit/conf-available/disc ln -s /etc/monit/conf-available/disc /etc/monit/conf-enabled/ sed -i 's/# set httpd/set httpd/' /etc/monit/monitrc sed -i 's/^# allow localhost/ allow localhost/' /etc/monit/monitrc echo -e "set mailserver 127.0.0.1\nset mail-format { from: Monit <monit@$DOMAIN>}\nset alert root@localhost" >> /etc/monit/monitrc - systemctl restart monit fi +# Monit all partition without swap and boot +list_of_part=(`grep -v "#\|swap\|noauto" /etc/fstab | awk '{print $2}'`) +echo "" > ./$$-parts +for part in "${list_of_part[@]}" +do + echo -e "check device root with path $part\n if SPACE usage > 75% then alert\nif SPACE usage > 75% timeout 86400 seconds then alert\n\n" >> ./$$-parts +done +mv ./$$-parts /etc/monit/conf-available/disc +systemctl restart monit + # Check rootkits and antivirus if [ `grep -c "^ALLOWHIDDENDIR=/etc/.java" /etc/rkhunter.conf` -eq 0 ] then