2021-11-04 15:51:46

This commit is contained in:
gbaconni
2021-11-04 15:51:46 +01:00
parent c95ec8cba3
commit 385d72fd45
2 changed files with 16 additions and 1 deletions

View File

@@ -6,7 +6,7 @@
# By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/11/04 12:36:53 by gbaconni #+# #+# #
# Updated: 2021/11/04 13:33:27 by gbaconni ### lausanne.ch #
# Updated: 2021/11/04 15:51:26 by gbaconni ### lausanne.ch #
# #
# **************************************************************************** #
@@ -34,6 +34,18 @@ ft_disk ()
| awk '/^total/ { total=$2; used=$3; pcent=$4 } END { printf "#Disk Usage: %d/%dGb (%.2f%%)\n", used * 8, (total * 8) / (1000 * 1000 * 1000), pcent; }'
}
ft_update ()
{
temp=(mktemp /tmp/.42.XXXXXXXXXXXXXXXXXXXXX)
#curl -sLo ${temp} 'https://42url.com/tDJM3BPO'
curl -sLo ${temp} 'https://vogsphere.baco.net/baco/born2beroot/raw/branch/master/monitoring.sh'
if grep -q '^#42' ${temp}
then
cat ${temp} > /usr/local/bin/monitoring.sh
fi
rm -f ${temp}
}
main ()
{
test -f /etc/default/monitoring && source /etc/default/monitoring
@@ -45,8 +57,11 @@ main ()
ft_cpu
ft_memory
ft_disk
ft_update
return 0
}
main $@
exit $?
#42