Gracefully fail if diskload.ini is not available.

This commit is contained in:
Fabian Schlenz 2024-12-19 09:48:07 +01:00
parent 71e652c94f
commit 81b295f4a3

View File

@ -57,5 +57,9 @@ if [ $found = 0 ]; then
exit 1
fi
read bytes_read bytes_written _ < <(grep $device"=" /var/local/emhttp/diskload.ini | cut -d"=" -f2)
echo '"bytes_reading":'$bytes_read', "bytes_writing":'$bytes_written'}'
if [ -e /var/local/emhttp/diskload.ini ]; then
read bytes_read bytes_written _ < <(grep $device"=" /var/local/emhttp/diskload.ini | cut -d"=" -f2)
echo '"bytes_reading":'$bytes_read', "bytes_writing":'$bytes_written'}'
else
echo '"diskload_missing":1}'
fi