diff scripts/run_project.sh @ 89:d41631e0fe0e

Added noise floor measurement project; also added option to run script to run without screen
author andrewm
date Sun, 19 Jul 2015 16:15:28 +0100
parents 91e1a3a220d4
children ccd084cf22ac
line wrap: on
line diff
--- a/scripts/run_project.sh	Sun Jul 19 14:15:57 2015 +0100
+++ b/scripts/run_project.sh	Sun Jul 19 16:15:28 2015 +0100
@@ -7,24 +7,28 @@
 BBB_PATH="~/BeagleRT"
 COMMAND_ARGS=
 RUN_IN_FOREGROUND=0
+RUN_WITHOUT_SCREEN=0
 
 function usage
 {
     THIS_SCRIPT=`basename "$0"`
-    echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-f]"
+    echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-fF]"
 
     echo "
     This script runs a previously compiled BeagleRT project on the 
     BeagleBone Black. The -b option changes the default path, which
     is otherwise $BBB_PATH. The -c option passes command-line arguments
     to the BeagleRT program; enclose the argument string in quotes.
+	
     The -f argument runs the project in the foreground of the current terminal,
-    within a screen session that can be detached later."
+    within a screen session that can be detached later. The -F argument runs
+	the project in the foreground of the current terminal, without screen, so
+	the output can be piped to another destination."
 }
 
 OPTIND=1
 
-while getopts "b:c:fh" opt; do
+while getopts "b:c:fFh" opt; do
     case $opt in
         b)            BBB_PATH=$OPTARG
                       ;;
@@ -32,6 +36,8 @@
                       ;;
         f)            RUN_IN_FOREGROUND=1
                       ;;
+		F)            RUN_WITHOUT_SCREEN=1
+		              ;;
         h|\?)         usage
                       exit 1
     esac
@@ -40,7 +46,10 @@
 shift $((OPTIND-1))
 
 echo "Running BeagleRT..."
-if [ $RUN_IN_FOREGROUND -eq 0 ]
+if [ $RUN_WITHOUT_SCREEN -ne 0 ]
+then
+	ssh -t $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT ; sleep 0.5 ; $BBB_PATH/BeagleRT $COMMAND_ARGS"	
+elif [ $RUN_IN_FOREGROUND -eq 0 ]
 then
     ssh $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT ; sleep 0.5 ; screen -S BeagleRT -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS"
 else