# vim: ft=sh function nginx () { nc -zw2 127.0.0.1 80 || echo "injoignable sur port 80 local" nc -zw2 paris12.pcf.fr 80 || echo "injoignable sur port 80 distant" nc -zw2 paris12.pcf.fr 443 || echo "injoignable sur port 443 distant" } function core_temp () { local min=60 local level=("warning" "severe" "danger!") local step=$(( $( $((min + step * 10))°" fi } function core_alim () { eval $(/opt/vc/bin/vcgencmd measure_volts core) volt_fmt=${volt/\.} volt_fmt=${volt_fmt/V} test $volt_fmt -lt 12000 -o $volt_fmt -gt 15000 && echo "$volt" } function undervoltage () { test $(grep -c "hwmon hwmon1" /var/log/syslog) -gt 0 && echo "Undervoltage detected!" } function clean_swap () { _turn 2 || return echo 1 > /proc/sys/vm/drop_caches if LANG=C free -m | awk ' /^Swap:/ { used = $3 } END { bash_exit_code = !(used > 31) exit bash_exit_code } '; then systemctl stop dphys-swapfile \ && systemctl stop zram \ && systemctl start zram \ && systemctl start dphys-swapfile \ || echo 'erreur' fi } function mem_pressure () { local meminfo=($(