From: Siraaj Khandkar Date: Thu, 14 Feb 2019 20:26:46 +0000 (-0500) Subject: Run sanity_check sensors as children and pre-kill all existing X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=7c4d20a90d6b9ec4f3b11bdbc9d3930180b2b11e;p=khatus.git Run sanity_check sensors as children and pre-kill all existing --- diff --git a/x4/sanity_check b/x4/sanity_check index 8100c2f..036d4b9 100755 --- a/x4/sanity_check +++ b/x4/sanity_check @@ -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