Skip to content
Draft
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
49 changes: 49 additions & 0 deletions kgo_updates/kgo_update/jules_kgo_update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# Needs to be run as julesadmin 'xsudo -iu julesadmin'

set -e

# Set the expected username
EXPECTED_USER="julesadmin"

# Get the current username
CURRENT_USER=$(whoami)

# Check if the script is run by the expected user
if [ "$CURRENT_USER" != "$EXPECTED_USER" ]; then
echo "Error: This script must be run as $EXPECTED_USER."
exit 1
fi

read -rp "KGO VERSION:" KGO_VERSION
read -rp "USER NAME:" USER_NAME
read -rp "SUITE/RUNX NAME:" SUITE
read -rp "EX ZONE:" EX_ZONE

# Azure spice kgo dir
AZURE_KGO_DIR=/data/users/julesadmin/jules/rose-stem/jules-kgo/$KGO_VERSION
mkdir -p "$AZURE_KGO_DIR"
cp /home/users/"$USER_NAME"/cylc-run/"$SUITE"/work/1/meto_azspice_*/output/* "$AZURE_KGO_DIR"

# select the zone to resync based on user inputted EX_ZONE
if [ "$EX_ZONE" == "exab" ]; then
echo "exab choosen"
EX_ZONE=login.exab.sc
EX_ZONE_RSYNC=login.excd.sc

elif [ "$EX_ZONE" == "excd" ]; then
echo "excd choosen"
EX_ZONE=login.excd.sc
EX_ZONE_RSYNC=login.exab.sc

else
echo "ex zone not entered or incorrect, please enter \"exab\" or \"excd\"."
exit
fi

# EXAB EXCD rsync files
EX_KGO_DIR=/common/internal/jules/rose-stem-kgo/$KGO_VERSION
ssh -Y $EX_ZONE "echo "new kgo dir: "$EX_KGO_DIR""; mkdir -p $EX_KGO_DIR; cp /home/users/$USER_NAME/cylc-run/$SUITE/work/1/meto_ex1a_*/output/* $EX_KGO_DIR; rsync -avz $EX_KGO_DIR $EX_ZONE_RSYNC:/common/internal/jules/rose-stem-kgo/"

exit