From eed06bdb223031dad448174c564ffa79f81cc7d1 Mon Sep 17 00:00:00 2001 From: Digimer Date: Wed, 18 Oct 2017 11:27:57 -0400 Subject: [PATCH] * Created a dedicated loop for processes that need to run each time tools/scancore-daemon loops. Signed-off-by: Digimer --- tools/scancore-daemon | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/scancore-daemon b/tools/scancore-daemon index 57173529..623b916e 100755 --- a/tools/scancore-daemon +++ b/tools/scancore-daemon @@ -34,12 +34,12 @@ run_once($an); # These are the things we always want running. while(1) { - update_state_file($an); - + # Loop and sleep for 2s. + keep_running($an); sleep 2; } -exit(0); +$an->nice_exit({code => 0}); ############################################################################################################# # Functions # @@ -60,6 +60,17 @@ sub run_once return(0); } +# These are tools that need to keep running. +sub keep_running +{ + my ($an) = @_; + + # Update hardware state files. + update_state_file($an); + + return(0); +} + # This calls 'scancore-update-states' which will scan the local machine's state (hardware and software) and # record write it out to an HTML file sub update_state_file