Gracefully fail if diskload.ini is not available.

This commit is contained in:
fabian committed 2024-12-19 09:48:42 +01:00
1 parent 71e652c94f
commit 81b295f4a3
1 file changed
+6 -2
@@ -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