Run sanity_check sensors as children and pre-kill all existing
authorSiraaj Khandkar <siraaj@khandkar.net>
Thu, 14 Feb 2019 20:26:46 +0000 (15:26 -0500)
committerSiraaj Khandkar <siraaj@khandkar.net>
Thu, 14 Feb 2019 20:26:46 +0000 (15:26 -0500)
x4/sanity_check

index 8100c2f..036d4b9 100755 (executable)
@@ -6,11 +6,13 @@ set -e
 
 dir="${prefix}/${host}"
 
-kill_sensor() {
-    if test -f "$1"
-    then
-        kill $(cat "$1")
-    fi
+kill_all() {
+    for pid_file in $(find $dir -type f -name pid)
+    do
+        kill -9 $(cat $pid_file) || true
+        rm $pid_file
+    done
+    pkill khatus_x4
 }
 
 read_sensor() {
@@ -22,13 +24,11 @@ read_sensor() {
     fi
 }
 
-kill_sensor ${dir}/khatus_x4_sensor_datetime/pid
-kill_sensor ${dir}/khatus_x4_sensor_mpd/pid
-kill_sensor ${dir}/khatus_x4_sensor_energy/pid
+kill_all
 
-./bin/khatus_x4_sensor_datetime -d
-./bin/khatus_x4_sensor_mpd -d
-./bin/khatus_x4_sensor_energy -d
+./bin/khatus_x4_sensor_datetime &
+./bin/khatus_x4_sensor_mpd      &
+./bin/khatus_x4_sensor_energy   &
 
 while :
 do
This page took 0.027215 seconds and 4 git commands to generate.