Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add imgr and merge iocmanager into one bash file #101

Merged
merged 8 commits into from
Feb 16, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
STY: Cleanliness fixes
ZryletTC committed Feb 14, 2022
commit 85633134e95dd4dfa7417499d573f6178f4fe6af
10 changes: 6 additions & 4 deletions scripts/imgr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# Setup environment
if [ -x /etc/pathinit ]; then
@@ -11,8 +11,9 @@ else
export IOC_DATA=/cds/data/iocData
export IOC_COMMON=/cds/data/iocCommon
fi
export PSPKG_OS=`${PSPKG_ROOT}/etc/pspkg_os.sh`
if [ $PSPKG_OS == rhel5 ]; then
PSPKG_OS=$(${PSPKG_ROOT}/etc/pspkg_os.sh)
export PSPKG_OS
if [ "$PSPKG_OS" == rhel5 ]; then
echo "IocManager 2.0.0 and higher does not run on RHEL5!" >&2
exit 1
fi
@@ -34,8 +35,9 @@ done
# 2. HUTCH environment variable
# 3. get_hutch_name
HUTCH=${ARGHUTCH:-$HUTCH}
HUTCH=${HUTCH:-`get_hutch_name`}
HUTCH=${HUTCH:-$(get_hutch_name)}

# Run if possible
if [[ "$HUTCH" == "unknown_hutch" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stuff like this makes me nervous about knock-on affects of upstream changes to get_hutch_name's output. This also does not catch e.g. --hutch xvs typos, but it probably doesn't need to.

Copy link
Contributor Author

@ZryletTC ZryletTC Feb 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, a quick function to check valid hutch names would be nice. Good quick issue for intern :)
Created #106

echo "Unknown hutch, please use --hutch argument" >&2
exit 1
18 changes: 11 additions & 7 deletions scripts/iocmanager
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ if [[ ($1 == "--help") || ($1 == "-h") ]]; then
exit 0
fi

# Setup environment
if [ -x /etc/pathinit ]; then
source /etc/pathinit
else
@@ -24,8 +25,9 @@ else
export IOC_DATA=/reg/d/iocData
export IOC_COMMON=/reg/d/iocCommon
fi
export PSPKG_OS=`${PSPKG_ROOT}/etc/pspkg_os.sh`
if [ $PSPKG_OS == rhel5 ]; then
PSPKG_OS=$(${PSPKG_ROOT}/etc/pspkg_os.sh)
export PSPKG_OS
if [ "$PSPKG_OS" == rhel5 ]; then
echo "IocManager 2.0.0 and higher does not run on RHEL5!"
exit 1
fi
@@ -34,24 +36,26 @@ export PSPKG_RELEASE=controls-0.1.9
source $PSPKG_ROOT/etc/set_env.sh
ulimit -c unlimited

DIR=$(readlink -f $(dirname "${BASH_SOURCE[0]}"))
DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
PATH=$PATH:$DIR

if [ "$#" -eq 0 ]; then
HUTCH=`get_hutch_name`
HUTCH=$(get_hutch_name)
else
HUTCH=$1
fi

# Run if possible
if [[ "$HUTCH" == "unknown_hutch" ]]; then
echo "Unknown hutch, please specify e.g. 'iocmanager xrt'" >&2
exit 1
else
/reg/g/pcds/pyps/config/${HUTCH}/iocmanager/IocManager.py --hutch $HUTCH > /dev/null &
/reg/g/pcds/pyps/config/"${HUTCH}"/iocmanager/IocManager.py --hutch "$HUTCH" > /dev/null &
fi

if [ `whoami` == "xppopr" ]; then
window_id=`xdotool search --sync --onlyvisible --name 'IocManager'`
# Do some window cleanup for xpp
if [ "$(whoami)" == "xppopr" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gave me a laugh. Maybe eventually we should have some uniform way of doing this across the various scripts and hutches.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #107

window_id=$(xdotool search --sync --onlyvisible --name 'IocManager')
if [ "xpp-control" == "$HOSTNAME" ]; then
wmctrl -v -i -r "$window_id" -e 0,3310,1100,530,1000
elif [ "xpp-daq" == "$HOSTNAME" ]; then