changeset 63:3ada83df91a5 newapi

Support stopping looped BeagleRT programs running within screen
author andrewm
date Wed, 15 Jul 2015 19:46:51 +0100
parents a11e23f4e6af
children b89dd0c97a04
files scripts/build_project.sh scripts/run_project.sh scripts/setup_board.sh scripts/stop_running.sh
diffstat 4 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/build_project.sh	Wed Jul 15 19:40:15 2015 +0100
+++ b/scripts/build_project.sh	Wed Jul 15 19:46:51 2015 +0100
@@ -64,7 +64,7 @@
 
 # Stop BeagleRT and clean out old source files
 echo "Stopping BeagleRT and removing old source files..."
-ssh -t -t $BBB_ADDRESS "kill -s 2 \`pidof BeagleRT\` 2>/dev/null; sleep 0.5; make sourceclean -C $BBB_PATH"
+ssh -t -t $BBB_ADDRESS "screen -X -S BeagleRT quit ; pkill BeagleRT ; sleep 0.5; make sourceclean -C $BBB_PATH"
 
 # Copy new source files to the board
 echo "Copying new source files to BeagleBone..."
--- a/scripts/run_project.sh	Wed Jul 15 19:40:15 2015 +0100
+++ b/scripts/run_project.sh	Wed Jul 15 19:46:51 2015 +0100
@@ -42,7 +42,7 @@
 echo "Running BeagleRT..."
 if [ $RUN_IN_FOREGROUND -eq 0 ]
 then
-    ssh $BBB_ADDRESS "kill -s 2 \`pidof BeagleRT\` 2>/dev/null ; sleep 0.5 ; screen -S BeagleRT -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS"
+    ssh $BBB_ADDRESS "screen -X -S BeagleRT quit ; pkill BeagleRT ; sleep 0.5 ; screen -S BeagleRT -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS"
 else
-    ssh -t $BBB_ADDRESS "kill -s 2 \`pidof BeagleRT\` 2>/dev/null ; sleep 0.5 ; screen -S BeagleRT $BBB_PATH/BeagleRT $COMMAND_ARGS"
+    ssh -t $BBB_ADDRESS "screen -X -S BeagleRT quit ; pkill BeagleRT ; sleep 0.5 ; screen -S BeagleRT $BBB_PATH/BeagleRT $COMMAND_ARGS"
 fi
\ No newline at end of file
--- a/scripts/setup_board.sh	Wed Jul 15 19:40:15 2015 +0100
+++ b/scripts/setup_board.sh	Wed Jul 15 19:46:51 2015 +0100
@@ -44,7 +44,7 @@
 then
 # Stop BeagleRT if running and remove all files
   echo "Stopping BeagleRT and removing old files." 
-  ssh $BBB_ADDRESS "kill -s 2 \`pidof BeagleRT\` 2>/dev/null ; sleep 0.5 ; rm -rf $BBB_PATH ; mkdir $BBB_PATH"
+  ssh $BBB_ADDRESS "screen -X -S BeagleRT quit ; pkill BeagleRT ; sleep 0.5 ; rm -rf $BBB_PATH ; mkdir $BBB_PATH"
 
 # Copy relevant files to BeagleBone Black
   echo "Copying new files to BeagleBone..."
--- a/scripts/stop_running.sh	Wed Jul 15 19:40:15 2015 +0100
+++ b/scripts/stop_running.sh	Wed Jul 15 19:46:51 2015 +0100
@@ -5,4 +5,7 @@
 BBB_ADDRESS="root@192.168.7.2"
 
 echo "Stopping BeagleRT..."
-ssh $BBB_ADDRESS "kill -s 2 \`pidof BeagleRT\` 2>/dev/null"
\ No newline at end of file
+
+# The first command should be sufficient to stop any BeagleRT run with
+# these scripts; the second will catch any leftovers run other ways
+ssh $BBB_ADDRESS "screen -X -S BeagleRT quit ; pkill BeagleRT"
\ No newline at end of file