Mercurial > hg > beaglert
comparison scripts/run_project.sh @ 67:472e892c6e41
Merge newapi into default
author | Andrew McPherson <a.mcpherson@qmul.ac.uk> |
---|---|
date | Fri, 17 Jul 2015 15:28:18 +0100 |
parents | 3ada83df91a5 |
children | 91e1a3a220d4 |
comparison
equal
deleted
inserted
replaced
21:0d80ff9e2227 | 67:472e892c6e41 |
---|---|
1 #!/bin/bash | |
2 # | |
3 # This script runs an already-compiled BeagleRT project on the | |
4 # BeagleBone Black. | |
5 | |
6 BBB_ADDRESS="root@192.168.7.2" | |
7 BBB_PATH="~/BeagleRT" | |
8 COMMAND_ARGS= | |
9 RUN_IN_FOREGROUND=0 | |
10 | |
11 function usage | |
12 { | |
13 THIS_SCRIPT=`basename "$0"` | |
14 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-f]" | |
15 | |
16 echo " | |
17 This script runs a previously compiled BeagleRT project on the | |
18 BeagleBone Black. The -b option changes the default path, which | |
19 is otherwise $BBB_PATH. The -c option passes command-line arguments | |
20 to the BeagleRT program; enclose the argument string in quotes. | |
21 The -f argument runs the project in the foreground of the current terminal, | |
22 within a screen session that can be detached later." | |
23 } | |
24 | |
25 OPTIND=1 | |
26 | |
27 while getopts "b:c:fh" opt; do | |
28 case $opt in | |
29 b) BBB_PATH=$OPTARG | |
30 ;; | |
31 c) COMMAND_ARGS=$OPTARG | |
32 ;; | |
33 f) RUN_IN_FOREGROUND=1 | |
34 ;; | |
35 h|\?) usage | |
36 exit 1 | |
37 esac | |
38 done | |
39 | |
40 shift $((OPTIND-1)) | |
41 | |
42 echo "Running BeagleRT..." | |
43 if [ $RUN_IN_FOREGROUND -eq 0 ] | |
44 then | |
45 ssh $BBB_ADDRESS "screen -X -S BeagleRT quit ; pkill BeagleRT ; sleep 0.5 ; screen -S BeagleRT -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS" | |
46 else | |
47 ssh -t $BBB_ADDRESS "screen -X -S BeagleRT quit ; pkill BeagleRT ; sleep 0.5 ; screen -S BeagleRT $BBB_PATH/BeagleRT $COMMAND_ARGS" | |
48 fi |