5 . .
/bin
/khatus_x4_lib_common_sensor.sh
7 dir
="${prefix}/${host}"
10 for pid_file
in $
(find $dir -type f
-name pid
)
12 kill -9 $
(cat $pid_file) || true
15 pkill khatus_x4 || true
19 .
/bin
/khatus_x4_sensor_datetime
-d -i 1
20 .
/bin
/khatus_x4_sensor_bluetooth
-d -i 1
21 .
/bin
/khatus_x4_sensor_mpd
-d -i 1
22 .
/bin
/khatus_x4_sensor_energy
-d -i 1
23 .
/bin
/khatus_x4_sensor_memory
-d -i 1
24 .
/bin
/khatus_x4_sensor_loadavg
-d -i 1
25 .
/bin
/khatus_x4_sensor_temp
-d -i 1 -- -z 0
26 .
/bin
/khatus_x4_sensor_disk
-d -i 1 -- -f /
41 battery_state
="$(sensor_read_one ${dir}/khatus_x4_sensor_energy/out/battery_state)"
42 battery_percentage
="$(sensor_read_one ${dir}/khatus_x4_sensor_energy/out/battery_percentage)"
43 bluetooth_controllers
="$(sensor_read_one ${dir}/khatus_x4_sensor_bluetooth/out/count_powered_controllers)"
44 bluetooth_devices
="$(sensor_read_one ${dir}/khatus_x4_sensor_bluetooth/out/count_connected_devices)"
45 datetime
="$(sensor_read_one ${dir}/khatus_x4_sensor_datetime/out/datetime)"
46 mpd
="$(sensor_read_one ${dir}/khatus_x4_sensor_mpd/out/status)"
47 mem
="$(sensor_read_one ${dir}/khatus_x4_sensor_memory/out/percent_used)"
48 load
="$(sensor_read_one ${dir}/khatus_x4_sensor_loadavg/out/load_avg_1min)"
49 temp
="$(sensor_read_one ${dir}/khatus_x4_sensor_temp/out/thermal_zone0)"
50 disk
="$(sensor_read_one ${dir}/khatus_x4_sensor_disk/out/disk_usage_percentage)"
51 echo "E[${battery_state} ${battery_percentage}] M:${mem}% L:${load} T:${temp}°C D:${disk}% [${mpd}] [$bluetooth_controllers $bluetooth_devices] ${datetime}"