Combine mpd status and use symbolic state indicators
[khatus.git] / x4 / sanity_check
CommitLineData
4411059d
SK
1#! /bin/sh
2
3set -e
4
5. ./bin/khatus_x4_lib_common_sensor.sh
6
7dir="${prefix}/${host}"
8
9kill_sensor() {
10 if test -f "$1"
11 then
12 kill $(cat "$1")
13 fi
14}
15
16read_sensor() {
17 if test -f "$1"
18 then
19 cat "$1"
20 else
21 printf '%s\n' '--'
22 fi
23}
24
25kill_sensor ${dir}/khatus_x4_sensor_datetime/pid
26kill_sensor ${dir}/khatus_x4_sensor_mpd/pid
27kill_sensor ${dir}/khatus_x4_sensor_energy/pid
28
29./bin/khatus_x4_sensor_datetime -d
30./bin/khatus_x4_sensor_mpd -d
31./bin/khatus_x4_sensor_energy -d
32
33while :
34do
35 battery_state="$(read_sensor ${dir}/khatus_x4_sensor_energy/out/battery_state)"
36 battery_percentage="$(read_sensor ${dir}/khatus_x4_sensor_energy/out/battery_percentage)"
37 datetime="$(read_sensor ${dir}/khatus_x4_sensor_datetime/out/datetime)"
81f81623
SK
38 mpd="$(read_sensor ${dir}/khatus_x4_sensor_mpd/out/status)"
39 echo "E[${battery_state} ${battery_percentage}] [${mpd}] ${datetime}"
4411059d
SK
40 sleep 1
41done
This page took 0.01903 seconds and 4 git commands to generate.