@cryptotaxi247 / netdata-1 / commits / ff0b46274

fallback if /proc/uptime is not there or cannot be read

Costa Tsaousis (ktsaou) committed Sep 12, 2016 at 23:54 UTC ff0b46274bc03c8cb50ac805d88ab966824b21d5
1 file changed +9
plugins.d/loopsleepms.sh.inc
+9
@@ -32,6 +32,15 @@ current_time_ms_from_uptime() {
32 local up rest arr n
33
34 read up rest </proc/uptime
35 + if [ $? -ne 0 ]
36 + then
37 + echo >&2 "$0: Cannot read /proc/uptime - falling back to current_time_ms_from_date()."
38 + current_time_ms="current_time_ms_from_date"
39 + current_time_ms_from_date
40 + current_time_ms_accuracy=1
41 + return
42 + fi
43 +
44 arr=(${up//./ })
45
46 if [ ${#arr[1]} -lt 1 ]