1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monitorix_ynh.git synced 2024-09-03 19:46:06 +02:00

use default value if can't retrive max netspeed

This commit is contained in:
Josué Tille 2024-04-26 21:48:22 +02:00
parent d7dd38a934
commit e2b0e14719
No known key found for this signature in database
GPG key ID: 5F259226AD51F2F5

View file

@ -79,7 +79,7 @@ load_vars() {
readonly home_user_dirs="$(echo /home/* | home_dir_filter)"
readonly net_gateway="$(ip --json route show default | jq -r '.[0].dev')"
readonly net_interface_list="$(ip --json link show | jq -r '.[].ifname | select(. != "lo")' | interface_speed_map)"
readonly net_max_speed="$(cat /sys/class/net/*/speed 2>/dev/null | sort | tail -n1)"
readonly net_max_speed="$(cat /sys/class/net/*/speed 2>/dev/null | sort | tail -n1 | sed 's|-1|1000|g')"
readonly ssh_port="$((grep ssh_port /etc/yunohost/settings.yml || echo 22) | cut -d: -f2 | xargs)"
readonly port_infos="$(python3 <<EOF
import yaml, socket