Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions scripts/get_curr_exp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ do
esac
done

DIRTMP=`dirname "${BASH_SOURCE[0]}"`
DIR="$( cd $DIRTMP && pwd -P )"
PATH=$PATH:$DIR
DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
PATH=$DIR:$PATH

if [ $INSTRUMENT != 'xxx' ]; then
CURR_EXP=`get_info --hutch ${INSTRUMENT^^} --exp`
Expand Down
5 changes: 2 additions & 3 deletions scripts/get_hutch_name
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ if [[ ($1 == "--help") || ($1 == "-h") ]]; then
exit 0
fi

DIRTMP=`dirname "${BASH_SOURCE[0]}"`
DIR="$( cd $DIRTMP && pwd -P )"
PATH=$PATH:$DIR
DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
PATH=$DIR:$PATH

hutch=`get_info --gethutch`
echo $hutch
5 changes: 2 additions & 3 deletions scripts/get_lastRun
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ AskLive=0
Ended=0
INSTRUMENT='xxx'

DIRTMP=`dirname "${BASH_SOURCE[0]}"`
DIR="$( cd $DIRTMP && pwd -P )"
PATH=$PATH:$DIR
DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
PATH=$DIR:$PATH

while getopts "H:i:le" OPTION
do
Expand Down
2 changes: 1 addition & 1 deletion scripts/imgr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fi

# Add engineering_tools to PATH for get_hutch_name
DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
PATH=$PATH:$DIR
PATH=$DIR:$PATH

# Search for hutch in args
for (( i=1; i<=$#; i++)); do
Expand Down
2 changes: 1 addition & 1 deletion scripts/iocmanager
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi

# Check hutch
DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
PATH=$PATH:$DIR
PATH=$DIR:$PATH
HUTCH=${1:-$(get_hutch_name)}

# Exit if hutch is still unknown
Expand Down
39 changes: 24 additions & 15 deletions scripts/ioctool
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ function iocfpv {
fi
}

function iocdir {
ioc=$1
iocpath=""
iocpath=$(grep_ioc "$ioc" all | grep "id:'$ioc'" | sed -n "s/^.*dir: '\(\S*\)'.*$/\1/p");
if [[ -z $iocpath ]]; then
echo "Did not find ${ioc} running anywhere. Exiting..." >&2
function iocinfo {
INFO=""
INFO=$(grep_ioc "$1" all | grep "id:'$NAME'")
if [ -z "$INFO" ]; then
echo "$1 could not be found. Exiting..." >&2
exit 1
fi

}

function iocdir {
iocinfo "$1"
iocpath=$(echo $INFO | sed -n "s/^.*dir: '\(\S*\)'.*$/\1/p");
if [[ ! $iocpath =~ ^/.* ]]; then
iocpath=/reg/g/pcds/epics/"${iocpath}"
iocpath=/reg/g/pcds/epics/"${iocpath}"
fi

}

function ioccfg {
Expand All @@ -34,7 +36,6 @@ function ioccfg {
exit 1
fi
fi

}

usage(){
Expand Down Expand Up @@ -121,15 +122,23 @@ elif [ "$CMD" == "data" ]; then
#################################################################

elif [ "$CMD" == "telnet" ]; then
INFO=$(grep_ioc "$NAME" all | grep "id:'$NAME'")
if [ -z "$INFO" ]; then
echo "$NAME could not be found. Exiting..." >&2
exit 1
fi
iocinfo "$NAME"
HOST=$(echo "$INFO" | sed -n "s/^.*host: '\(\S*\)'.*$/\1/p")
PORT=$(echo "$INFO" | sed -n "s/^.*port: \(\S*\),.*$/\1/p")
#if [[ 39000 >= "$PORT" >=39999 ]];
# echo "Host no in subnet that connect"
echo "$HOST":"$PORT"
telnet "$HOST" "$PORT"

#################################################################

elif [ "$CMD" == "host" ]; then
iocinfo "$NAME"
echo "$INFO" | sed -n "s/^.*host: '\(\S*\)'.*$/\1/p"

#################################################################

else
echo "Command not supported: $CMD" >&2
exit 1
fi
5 changes: 2 additions & 3 deletions scripts/makepeds
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#! /bin/bash

DIRTMP=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
DIR="$( cd $DIRTMP && pwd -P )"
PATH=$PATH:$DIR
DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
PATH=$DIR:$PATH

usage()
{
Expand Down
24 changes: 13 additions & 11 deletions scripts/serverStat
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,24 @@ isCam(){
host_from_PV(){
if [[ $NAME == *':'* ]] && [[ $HUTCH == 'unknown_hutch' ]]; then
echo 'Getting info for a host of a PV currently only works on the hutch networks'
exit
exit 1
fi
if [[ ${NAME:0:3} == "${HUTCH^^}" ]]; then
HOST=$(cainfo "$NAME" | grep Host | awk '{print $2}' | awk 'BEGIN { FS = ":"}; {print $1}' | sed s/'.pcdsn'/''/g)
if [[ $HOST == *'disconnected'* ]]; then
echo PV "$NAME" is disconnected
exit
echo "PV $NAME is disconnected"
exit 1
fi
echo PV "$NAME" is hosted on server "$HOST"
NAME=$HOST
DEV=$HOST
else
echo 'Getting info for a host of a PV currently only works on the hutch network (e.g. for MFX:xxx from the mfx network)'
exit
HOST=$(ioctool $NAME host)
if [[ -z "$HOST" ]]; then
echo "Host can't be found for PV $NAME"
exit 1
fi
fi
echo PV "$NAME" is hosted on server "$HOST"
NAME=$HOST
DEV=$HOST
}

usage(){
Expand All @@ -88,9 +91,8 @@ expert : display info and run checks on server
EOF
}

DIRTMP=$(dirname "${BASH_SOURCE[0]}")
DIR=$( cd "$DIRTMP" && pwd -P )
PATH=$PATH:$DIR
DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
PATH=$DIR:$PATH

HUTCH=$(get_hutch_name)
for name in "tmo" "rix" "txi" "xpp" "xcs" "mfx" "cxi" "mec" "det"; do
Expand Down