Skip to content

Commit

Permalink
Pulled in bug fixes from Docker-REDHAWK that were discovered as this …
Browse files Browse the repository at this point in the history
…set of images were developed.
  • Loading branch information
Thomas Goodwin committed Jun 12, 2017
1 parent abdf9ab commit 451d4e5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
18 changes: 10 additions & 8 deletions scripts/show-log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ function print_status() {
function usage () {
cat <<EOF
Usage: $0 CONTAINER_NAME
Usage: $0 CONTAINER_NAME [options]
[CONTAINER_NAME] The Docker Container name to view
[-l|--log LOG_NAME] The log file name to display
Default is the one found in /var/log/supervisord/... .log
[-n NUM_LINES] The number of lines of the log to display, default 50
[-l|--log LOG_NAME] The log file name(s) to display.
The default is to show all found in
/var/log/supervisord/... .log
[-n NUM_LINES] The number of lines of the log to display, default 50
Examples:
List all running containers:
Expand All @@ -61,11 +62,12 @@ if [ -z ${1+x} ]; then
fi

# Parse arguments
LOG_NAME=""
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-l|--log)
LOG_NAME="${2:?Missing LOG_NAME Argument}"
LOG_NAME="${2:?Missing LOG_NAME Argument} ${LOG_NAME}"
shift
;;
-n)
Expand Down Expand Up @@ -110,9 +112,9 @@ case $? in
;;
*)
echo Displaying log... Type \"CTRL+C\" when finished.
if [ -z ${LOG_NAME+x} ]; then
LOG_NAME=`docker exec ${CONTAINER_NAME} bash -c "find /var/log/supervisord -name '*.log' -print -quit"`
if [ -z ${LOG_NAME} ]; then
LOG_NAME='/var/log/supervisord/*.log'
fi
docker exec -it ${CONTAINER_NAME} bash -c "tail -fn ${NUM_LINES} ${LOG_NAME}"
docker exec -it ${CONTAINER_NAME} bash -c "cat ${LOG_NAME} | tail -fn ${NUM_LINES} ${LOG_NAME}"
;;
esac
25 changes: 12 additions & 13 deletions scripts/usrp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ function usage () {
cat <<EOF
Usage: $0 start|stop NODE_NAME
[-u|--usrp] USRP_NAME] Name for the USRP Device (default: USRP_UHD_...)
[-d|--domain DOMAIN_NAME] Domain Name, default is REDHAWK_DEV
[-o|--omni OMNISERVER] IP to the OmniServer (detected: ${OMNISERVER})
[--usrptype USRP_TYPE] USRP type according to UHD (b200, etc., optional)
[--usrpserial USRP_SERIAL] USRP Serial number for UHD (optional)
[--usrpname USRP_NAME] USRP name according to UHD (optional)
[--usrpip USRP_IP] USRP IP Address (for networked devices, optional)
[--list-usb] Print list of possible USB USRPs
[-p|--print] Print resolved settings
Expand Down Expand Up @@ -113,32 +113,32 @@ while [[ $# -gt 0 ]]; do
shift
fi
;;
-u|--usrp)
USRP_NAME="$2"
shift
;;
-d|--domain)
DOMAIN_NAME="$2"
DOMAIN_NAME="${2:?Missing DOMAIN_NAME Argument}"
shift
;;
-o|--omni)
OMNISERVER="$2"
OMNISERVER="${2:?Missing OMNISERVER Argument}"
shift
;;
-h|--help)
usage
exit 0
;;
--usrptype)
USRP_TYPE="$2"
USRP_TYPE="${2:?Missing USRP_TYPE Argument}"
shift
;;
--usrpname)
USRP_NAME="${2:?Missing USRP_NAME Argument}"
shift
;;
--usrpserial)
USRP_SERIAL="$2"
USRP_SERIAL="${2:?Missing USRP_SERIAL Argument}"
shift
;;
--usrpip)
USRP_IP="$2"
USRP_IP="${2:?Missing USRP_IP Argument}"
shift
;;
--list-usb)
Expand All @@ -164,16 +164,15 @@ if [ -z ${COMMAND+x} ]; then
fi

# Enforce defaults
USRP_NAME=${USRP_NAME:-USRP_UHD_$(uuidgen)}
DOMAIN_NAME=${DOMAIN_NAME:-REDHAWK_DEV}

if ! [ -z ${JUST_PRINT+x} ]; then
cat <<EOF
Resolved Settings:
COMMAND: ${COMMAND}
NODE_NAME: ${NODE_NAME}
USRP_NAME: ${USRP_NAME}
DOMAIN_NAME: ${DOMAIN_NAME}
USRP_NAME: ${USRP_NAME:-Not Specified}
USRP_TYPE: ${USRP_TYPE:-Not Specified}
USRP_SERIAL: ${USRP_SERIAL:-Not Specified}
USRP_IP: ${USRP_IP:-Not Specified}
Expand Down Expand Up @@ -203,7 +202,7 @@ if [[ $COMMAND == "start" ]]; then
fi

# Verify at least one of the usrp options has been set
if [ -z ${USRP_TYPE+x} ] && [ -z ${USRP_SERIAL+x} ] && [ -z ${USRP_IP+x} ] ]; then
if [ -z ${USRP_NAME+x} ] && [ -z ${USRP_TYPE+x} ] && [ -z ${USRP_SERIAL+x} ] && [ -z ${USRP_IP+x} ] ]; then
usage
echo ERROR: At least one of the --usrp... options must be specified to find the device
exit 1
Expand Down

0 comments on commit 451d4e5

Please sign in to comment.