comparison scripts/run_project.sh @ 60:ad6b2767beaf newapi

Command-line argument support for BeagleRT program in scripts, plus a simple script for halting the BBB
author andrewm
date Wed, 15 Jul 2015 18:53:10 +0100
parents 3ffafa57302c
children afc593f7469e
comparison
equal deleted inserted replaced
59:5bdf6efbd0ed 60:ad6b2767beaf
3 # This script runs an already-compiled BeagleRT project on the 3 # This script runs an already-compiled BeagleRT project on the
4 # BeagleBone Black. 4 # BeagleBone Black.
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 9
9 function usage 10 function usage
10 { 11 {
11 THIS_SCRIPT=`basename "$0"` 12 THIS_SCRIPT=`basename "$0"`
12 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone]" 13 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args]"
13 14
14 echo " 15 echo "
15 This script runs a previously compiled BeagleRT project on the 16 This script runs a previously compiled BeagleRT project on the
16 BeagleBone Black. The -b option changes the default path, which 17 BeagleBone Black. The -b option changes the default path, which
17 is otherwise $BBB_PATH." 18 is otherwise $BBB_PATH. The -c option passes command-line arguments
19 to the BeagleRT program; enclose the argument string in quotes."
18 } 20 }
19 21
20 OPTIND=1 22 OPTIND=1
21 23
22 while getopts "b:h" opt; do 24 while getopts "b:c:h" opt; do
23 case $opt in 25 case $opt in
24 b) BBB_PATH=$OPTARG 26 b) BBB_PATH=$OPTARG
27 ;;
28 c) COMMAND_ARGS=$OPTARG
25 ;; 29 ;;
26 h|\?) usage 30 h|\?) usage
27 exit 1 31 exit 1
28 esac 32 esac
29 done 33 done
30 34
31 shift $((OPTIND-1)) 35 shift $((OPTIND-1))
32 36
33 echo "Running BeagleRT..." 37 echo "Running BeagleRT..."
34 ssh $BBB_ADDRESS "kill -s 2 \`pidof BeagleRT\` 2>/dev/null ; sleep 0.5 ; screen -d -m $BBB_PATH/BeagleRT" 38 ssh $BBB_ADDRESS "kill -s 2 \`pidof BeagleRT\` 2>/dev/null ; sleep 0.5 ; screen -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS"