Mercurial > hg > beaglert
comparison 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 |
comparison
equal
deleted
inserted
replaced
88:3a5823f7a11f | 89:d41631e0fe0e |
---|---|
5 | 5 |
6 BBB_ADDRESS="root@192.168.7.2" | 6 BBB_ADDRESS="root@192.168.7.2" |
7 BBB_PATH="~/BeagleRT" | 7 BBB_PATH="~/BeagleRT" |
8 COMMAND_ARGS= | 8 COMMAND_ARGS= |
9 RUN_IN_FOREGROUND=0 | 9 RUN_IN_FOREGROUND=0 |
10 RUN_WITHOUT_SCREEN=0 | |
10 | 11 |
11 function usage | 12 function usage |
12 { | 13 { |
13 THIS_SCRIPT=`basename "$0"` | 14 THIS_SCRIPT=`basename "$0"` |
14 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-f]" | 15 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-fF]" |
15 | 16 |
16 echo " | 17 echo " |
17 This script runs a previously compiled BeagleRT project on the | 18 This script runs a previously compiled BeagleRT project on the |
18 BeagleBone Black. The -b option changes the default path, which | 19 BeagleBone Black. The -b option changes the default path, which |
19 is otherwise $BBB_PATH. The -c option passes command-line arguments | 20 is otherwise $BBB_PATH. The -c option passes command-line arguments |
20 to the BeagleRT program; enclose the argument string in quotes. | 21 to the BeagleRT program; enclose the argument string in quotes. |
22 | |
21 The -f argument runs the project in the foreground of the current terminal, | 23 The -f argument runs the project in the foreground of the current terminal, |
22 within a screen session that can be detached later." | 24 within a screen session that can be detached later. The -F argument runs |
25 the project in the foreground of the current terminal, without screen, so | |
26 the output can be piped to another destination." | |
23 } | 27 } |
24 | 28 |
25 OPTIND=1 | 29 OPTIND=1 |
26 | 30 |
27 while getopts "b:c:fh" opt; do | 31 while getopts "b:c:fFh" opt; do |
28 case $opt in | 32 case $opt in |
29 b) BBB_PATH=$OPTARG | 33 b) BBB_PATH=$OPTARG |
30 ;; | 34 ;; |
31 c) COMMAND_ARGS=$OPTARG | 35 c) COMMAND_ARGS=$OPTARG |
32 ;; | 36 ;; |
33 f) RUN_IN_FOREGROUND=1 | 37 f) RUN_IN_FOREGROUND=1 |
34 ;; | 38 ;; |
39 F) RUN_WITHOUT_SCREEN=1 | |
40 ;; | |
35 h|\?) usage | 41 h|\?) usage |
36 exit 1 | 42 exit 1 |
37 esac | 43 esac |
38 done | 44 done |
39 | 45 |
40 shift $((OPTIND-1)) | 46 shift $((OPTIND-1)) |
41 | 47 |
42 echo "Running BeagleRT..." | 48 echo "Running BeagleRT..." |
43 if [ $RUN_IN_FOREGROUND -eq 0 ] | 49 if [ $RUN_WITHOUT_SCREEN -ne 0 ] |
50 then | |
51 ssh -t $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT ; sleep 0.5 ; $BBB_PATH/BeagleRT $COMMAND_ARGS" | |
52 elif [ $RUN_IN_FOREGROUND -eq 0 ] | |
44 then | 53 then |
45 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" | 54 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" |
46 else | 55 else |
47 ssh -t $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT ; sleep 0.5 ; screen -S BeagleRT $BBB_PATH/BeagleRT $COMMAND_ARGS" | 56 ssh -t $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT ; sleep 0.5 ; screen -S BeagleRT $BBB_PATH/BeagleRT $COMMAND_ARGS" |
48 fi | 57 fi |