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 bash, curl, and jq, feel free to use the language of your choice
- 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>
- 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 tool saminfo.sh provides more options and can be extended on request.
- Because hssrv2 is redirected to different hosts (load balancing) we recommend to add these lines to your ssh-config: ~/.ssh/config
Host hssrv2* UserKnownHostsFile /dev/null StrictHostKeyChecking no LogLevel ERROR
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
- multiple files:
- DIR="store/users/2023/2023-11-30_liegmahl"
FA="/hs/$DIR/*"
FB="/hs/$DIR/home_edvs1.tgz:/hs/$DIR/isibhv_personal.tgz:/hs/$DIR/isipd_home_pd.tgz"
FC='"$DIR/home_edvs1.tgz","$DIR/isibhv_personal.tgz","$DIR/isipd_home_pd.tgz"' # Note: "/hs/" is missing here!
- single file
- Some additional tasks can be done with ssh hssrv2 saminfo.sh
Task | RestAPI | ssh hssrv | saminfo.sh |
---|---|---|---|
filestat | eval $CURL -X GET $SERV/file?path="$F" eval $CURL -X PUT --data \'{\"path\":[$FC]}\' $SERV/batchfile | sls -D $F # use -E to show | saminfo.sh -f $F |
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}' | saminfo.sh -o -f $F | |
staging | eval $CURL -X POST $SERV/request/stage?path="$F" eval $CURL -X PUT --data \'{\"path\":[$FC]}\' $SERV/request/batchstage | Aufgrund eines Bugs leider noch nicht für normale User implementiert. | saminfo.sh -s $F |
show scheduler state | eval $CURL -X GET $SERV/queues | -- | saminfo.sh -S |
|
| ||
mkdir | -- | mkdir /hs/projects/<project>/newdir | -- |
release | release $F |
| |
|
| ||
|
|