diff --git a/.monitoring.sh.swp b/.monitoring.sh.swp new file mode 100644 index 0000000..1cab477 Binary files /dev/null and b/.monitoring.sh.swp differ diff --git a/monitoring.sh b/monitoring.sh index ece47dc..3acf747 100755 --- a/monitoring.sh +++ b/monitoring.sh @@ -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