diff --git a/kgo_updates/kgo_update/jules_kgo_update.sh b/kgo_updates/kgo_update/jules_kgo_update.sh new file mode 100644 index 0000000..a95fcf3 --- /dev/null +++ b/kgo_updates/kgo_update/jules_kgo_update.sh @@ -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