You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

Note: There is no way to get a login shell on the ScoutAM servers, but you can execute certain commands. Either via a RestAPI or using ssh.

RestAPI

  • These examples use  bashcurl, and jq, feel free to use the language of your choice slightly smiling face 
  • To use the RestAPI you will need a TOKEN
  • For clarity we also define the variables $CURL and $SERV for future use (see below)
TOKEN=$(curl -s -k -H 'Accept: application/json' -H 'Content-Type: application/json'  -X POST --data '{"acct":"'filestat'","pass":"'filestat'"}' https://hssrv2.dmawi.de:8080/v1/security/login |  jq -r '.response')
CURL='curl -s -k -H "Accept: application/json" -H "Content-Type: application/json"  -H "Authorization: Bearer $TOKEN"'
SERV='https://hssrv2.dmawi.de:8080/v1'
  • The token lifespan is 24 h and not client/server dependent

ssh hssrv2 

  • You can execute (some) commands on the ScoutAM servers using ssh hssrv2 <command>
  • hssrv2 is redirected to three different servers ( hssrv2a.dmawi.de, hssrv2b.dmawi.de and hssrv2c.dmawi.de) for load balancing.  However, if you want access to a specific server, feel free to use it explicitly.
  • We recommend to add these lines to your ~/.ssh/ssh_config
    ~/.ssh/config
    Host hssrv2*
       UserKnownHostsFile /dev/null
       StrictHostKeyChecking no
       LogLevel ERROR
  • The ScoutAM use your (standard) AWI $HOME. We suggest to create an ssh key pair with a passphrase (e.g., https://www.ssh.com/academy/ssh/keygen) there.
  • The help of tool saminfo.sh -h shows some options and can be extended on request. 

Specific taks

  • We use these file variables to provide some examples. Please note that the variable for several files have to formatted differently, depending on the preferred access method. 
    • single file
      • F=/hs/store/users/2023/2023-11-30_liegmahl/home_edvs1.tgz
    • directories
      • D="/hs/store/users/2023/2023-11-30_liegmahl"
    • multiple files:
      • DIR="store/users/2023/2023-11-30_liegmahl"                       # Note: no "/hs" here!
      • FA="/hs/$DIR/*"
      • FC='"$DIR/home_edvs1.tgz","$DIR/isibhv_personal.tgz","$DIR/isipd_home_pd.tgz"'   # Note: "/hs/" is missing here!
  • Some additional tasks can be done with ssh hssrv2 saminfo.sh 
TaskRestAPIssh hssrvssh hssrv 'saminfo.sh ...'
Shortcut FileF=/hs/store/users/2023/2023-11-30_liegmahl/home_edvs1.tgz

If you have special characters (e.g., spaces, brackets, ...) in your filename: Try to avoid them. Yes, really try to avoid then! However, if are forced to use special characters it will get nasty. You have
a) have to quote  the filename and/or
b) protect the special characters and in the filename: F="/hs/platforms/WORM/aircraft/polar6/macs/exdata/P6-244_ANT_23_24_2311300801/20231130-150529_[Record\ All]/111498_RGB/09835_041255631_500.macs".
c) and in addition to quote the ssh command correctly (see example)

Shortcut Directory

D="/hs/store/users/2023/2023-11-30_liegmahl"

Shortcut Multiple Files

DIR="store/users/2023/2023-11-30_liegmahl"                       # Note: no "/hs" here!
FC='"$DIR/home_edvs1.tgz","$DIR/isibhv_personal.tgz","$DIR/isipd_home_pd.tgz"'



filestat 
(everything)
eval $CURL -X GET $SERV/file?path="$F"
eval $CURL  -X PUT  --data \'{\"path\":[$FC]}\' $SERV/batchfile

sls -D $F       # use -E to show
sls -D $FA    # md5 checksum
sls -D $D

ssh hssrv2 'saminfo.sh -ga -f'"$F"
ssh hssrv2 saminfo.sh -ga -f"$D"
ssh hssrv2 saminfo.sh -ga -F$FL

filestat
(online/offline)
eval $CURL -X GET $SERV/file?path="$F" | jq -r .onlineblocks
eval $CURL  -X PUT  --data \'{\"path\":[$FC]}\' $SERV/batchfile | jq -r '.infos[] | {path, onlineblocks, error}'


ssh hssrv2 'saminfo.sh -go -f "$F"'
ssh hssrv2 saminfo.sh -go -f"$D"
ssh hssrv2 saminfo.sh -go -F$FL

staging
eval $CURL -X POST $SERV/request/stage?path="$F"
eval $CURL -X PUT  --data \'{\"path\":[$FC]}\' $SERV/request/batchstage

(minus) These won't work. Please use saminfo.sh instead(minus) 
stage $F

stage -r $D

ssh hssrv2 'saminfo.sh -s -f'"$F"
ssh hssrv2 saminfo.sh -s -f"$D"
ssh hssrv2 saminfo.sh -s -F$FL

show scheduler state
eval $CURL -X GET $SERV/queues

 --

ssh hssrv2 saminfo.sh -S



 

 

mkdir
--

mkdir /hs/projects/<project>/newdir

--

release

release $F

release -r $DIR

 

quota

 

ssh hssrv2 saminfo.sh -q



 

 

  • No labels