Skip to content

Commit

Permalink
take in full address now
Browse files Browse the repository at this point in the history
  • Loading branch information
shenghuanjie committed Oct 5, 2019
1 parent 6e2b2d7 commit 8f39a3f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions otp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,15 @@ fi

USERNAME=$(echo $CODE | awk '{print $1}')
PLAINCODE=$(echo $CODE | awk '{print $2}')
NODE=$(echo $CODE | awk '{print $3}')
if [[ -z $NODE ]]; then NODE="hpc"; fi
URL=$(echo $CODE | awk '{print $3}')
DTN=$(echo $CODE | awk '{print $4}')
if [[ -z $URL ]]; then URL="hpc.brc.berkeley.edu"; fi
if [[ -z $DTN ]]; then DTN="dtn.brc.berkeley.edu"; fi

# mount home
X=$( oathtool --totp -b "$TOKEN" )
saviokey=$PLAINCODE$X
saviopath="$USERNAME@dtn.brc.berkeley.edu:/global/home/users/$USERNAME/"
saviopath="$USERNAME@$DTN:/global/home/users/$USERNAME/"
if mountpoint -q ~/savio/home; then
sudo umount -f ~/savio/home
echo "umount ~/savio/home"
Expand All @@ -106,7 +108,7 @@ do
attempt=$((attempt+1))
done
saviokey=$PLAINCODE$Y
saviopath="$USERNAME@dtn.brc.berkeley.edu:/global/scratch/$USERNAME/"
saviopath="$USERNAME@$DTN:/global/scratch/$USERNAME/"
if mountpoint -q ~/savio/scratch; then
sudo umount -f ~/savio/scratch
echo "umount ~/savio/scratch"
Expand All @@ -128,4 +130,4 @@ do
Z=$( oathtool --totp -b "$TOKEN" )
attempt=$((attempt+1))
done
sshpass -p "$PLAINCODE$Z" ssh $USERNAME@$NODE.brc.berkeley.edu
sshpass -p "$PLAINCODE$Z" ssh $USERNAME@$URL

0 comments on commit 8f39a3f

Please sign in to comment.