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
23 .
/bin
/khatus_x4_sensor_energy_poller
-d -i 1
24 .
/bin
/khatus_x4_sensor_memory
-d -i 1
25 .
/bin
/khatus_x4_sensor_loadavg
-d -i 1
26 .
/bin
/khatus_x4_sensor_temp
-d -i 1 -- -z 0
27 .
/bin
/khatus_x4_sensor_disk
-d -i 1 -- -f /
28 .
/bin
/khatus_x4_sensor_volume
-d -i 1
43 battery_state
="$(sensor_read_one ${dir}/khatus_x4_sensor_energy/out/battery_state)"
44 battery_state_poll
="$(sensor_read_one ${dir}/khatus_x4_sensor_energy_poller/out/battery_state)"
45 battery_percentage
="$(sensor_read_one ${dir}/khatus_x4_sensor_energy/out/battery_percentage)"
46 battery_percentage_poll
="$(sensor_read_one ${dir}/khatus_x4_sensor_energy_poller/out/battery_percentage)"
47 bluetooth_controllers
="$(sensor_read_one ${dir}/khatus_x4_sensor_bluetooth/out/count_powered_controllers)"
48 bluetooth_devices
="$(sensor_read_one ${dir}/khatus_x4_sensor_bluetooth/out/count_connected_devices)"
49 datetime
="$(sensor_read_one ${dir}/khatus_x4_sensor_datetime/out/datetime)"
50 mpd
="$(sensor_read_one ${dir}/khatus_x4_sensor_mpd/out/status)"
51 mem
="$(sensor_read_one ${dir}/khatus_x4_sensor_memory/out/percent_used)"
52 load
="$(sensor_read_one ${dir}/khatus_x4_sensor_loadavg/out/load_avg_1min)"
53 temp
="$(sensor_read_one ${dir}/khatus_x4_sensor_temp/out/thermal_zone0)"
54 disk
="$(sensor_read_one ${dir}/khatus_x4_sensor_disk/out/disk_usage_percentage)"
55 vol_left
="$(sensor_read_one ${dir}/khatus_x4_sensor_volume/out/vol_left)"
56 vol_right
="$(sensor_read_one ${dir}/khatus_x4_sensor_volume/out/vol_right)"
57 vol_state
="$(sensor_read_one ${dir}/khatus_x4_sensor_volume/out/state)"
58 vol_mute
="$(sensor_read_one ${dir}/khatus_x4_sensor_volume/out/mute)"
59 echo "E[${battery_state} ${battery_percentage} | ${battery_state} ${battery_percentage_poll}] M:${mem}% L:${load} T:${temp}°C D:${disk}% [${mpd}] B:${bluetooth_controllers}:${bluetooth_devices} V:${vol_state}:${vol_left}:${vol_right}:${vol_mute} ${datetime}"