annotate scripts/run_project.sh @ 151:e9c9404e3d1f ClockSync

Pff partially working. No PID. When setting the audio clock on the bbb to 44098 the master and slave clock keep diverging instead of converging ...
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 22 Sep 2015 04:10:07 +0100
parents d41631e0fe0e
children ccd084cf22ac
rev   line source
andrewm@58 1 #!/bin/bash
andrewm@58 2 #
andrewm@58 3 # This script runs an already-compiled BeagleRT project on the
andrewm@58 4 # BeagleBone Black.
andrewm@58 5
andrewm@58 6 BBB_ADDRESS="root@192.168.7.2"
andrewm@58 7 BBB_PATH="~/BeagleRT"
andrewm@60 8 COMMAND_ARGS=
andrewm@62 9 RUN_IN_FOREGROUND=0
andrewm@89 10 RUN_WITHOUT_SCREEN=0
andrewm@58 11
andrewm@58 12 function usage
andrewm@58 13 {
andrewm@58 14 THIS_SCRIPT=`basename "$0"`
andrewm@89 15 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-fF]"
andrewm@58 16
andrewm@58 17 echo "
andrewm@58 18 This script runs a previously compiled BeagleRT project on the
andrewm@58 19 BeagleBone Black. The -b option changes the default path, which
andrewm@60 20 is otherwise $BBB_PATH. The -c option passes command-line arguments
andrewm@62 21 to the BeagleRT program; enclose the argument string in quotes.
andrewm@89 22
andrewm@62 23 The -f argument runs the project in the foreground of the current terminal,
andrewm@89 24 within a screen session that can be detached later. The -F argument runs
andrewm@89 25 the project in the foreground of the current terminal, without screen, so
andrewm@89 26 the output can be piped to another destination."
andrewm@58 27 }
andrewm@58 28
andrewm@58 29 OPTIND=1
andrewm@58 30
andrewm@89 31 while getopts "b:c:fFh" opt; do
andrewm@58 32 case $opt in
andrewm@58 33 b) BBB_PATH=$OPTARG
andrewm@58 34 ;;
andrewm@60 35 c) COMMAND_ARGS=$OPTARG
andrewm@60 36 ;;
andrewm@62 37 f) RUN_IN_FOREGROUND=1
andrewm@62 38 ;;
andrewm@89 39 F) RUN_WITHOUT_SCREEN=1
andrewm@89 40 ;;
andrewm@58 41 h|\?) usage
andrewm@58 42 exit 1
andrewm@58 43 esac
andrewm@58 44 done
andrewm@58 45
andrewm@58 46 shift $((OPTIND-1))
andrewm@58 47
andrewm@58 48 echo "Running BeagleRT..."
andrewm@89 49 if [ $RUN_WITHOUT_SCREEN -ne 0 ]
andrewm@89 50 then
andrewm@89 51 ssh -t $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT ; sleep 0.5 ; $BBB_PATH/BeagleRT $COMMAND_ARGS"
andrewm@89 52 elif [ $RUN_IN_FOREGROUND -eq 0 ]
andrewm@62 53 then
giuliomoro@85 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"
andrewm@62 55 else
giuliomoro@85 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"
andrewm@62 57 fi