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.
Host hsm* UserKnownHostsFile /dev/null StrictHostKeyChecking no LogLevel ERROR |
TOKEN=$(curl -s -k -H 'Accept: application/json' -H 'Content-Type: application/json' -X POST --data '{"acct":"'filestat'","pass":"'filestat'"}' https://hsm.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://hsm.dmawi.de:8080/v1' |
If you have special characters (e.g., spaces, brackets, ...) in your filename: Try to avoid them. Yes, really try to avoid them (this is no joke)! However, if are forced to use special characters it will get nasty. You have
protect the special characters and in the filename with "\": FILE="/hs/D-A/platforms/aircraft/polar6/macs/exdata/P6-244_ANT_23_24_2311300801/20231130-150529_[Record\ All]/111498_RGB/09835_041255631_500.macs".
and in addition you have to quote the ssh command correctly
ssh hsm.dmawi.de <command> | RestAPI | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
ScoutFS File System | Is defined by the path (e.g., /hs/D-P) | The command eval $CURL -X GET $SERV/filesystems provides the FSID of a filesystem (They change if filesystems are recreated):
Note: This documentation has not been updated for the use of multiple fs (fsid) and "batch"-commands yet ... | ||||||||||
Variable definition |
|
| ||||||||||
filestat (everything/all) | sls -D "$FILE" # use -E to show | eval $CURL -X GET "$SERV/file?fsid=$FSID&path=$FILE" | ||||||||||
filestat (selection) | eval $CURL -X GET "$SERV/file?fsid=$FSID&path=$F" | jq -r '. | {path, onlineblocks, flags, error}' | |||||||||||
filestat (online/offline) | eval $CURL -X GET "$SERV/file?fsid=$FSID&path=$F" | jq -r .onlineblocks eval $CURL -X PUT --data \'{\"path\":[$FC]}\' $SERV/batchfile | jq -r '.infos[] | {path, onlineblocks}' | |||||||||||
stage | saminfo.sh -f"$FILE" -Cstage | eval $CURL -X POST "$SERV/request/stage?fsid=$FSID&path=$F" eval $CURL -X PUT --data \'{\"path\":[$FC]}\' $SERV/request/batchstage | ||||||||||
show scheduler state | saminfo.sh -S | eval $CURL -X GET $SERV/queues | ||||||||||
online/offline information | saminfo.sh -Cc -f$DIR | |||||||||||
mkdir | mkdir /hs/D-P/projects/<project>/newdir | |||||||||||
release | saminfo.sh -f'"$FILE" -Crelease saminfo.sh -f'"$DIR" -Crelease | |||||||||||
quota | saminfo.sh -q | |||||||||||
Count number of (online/staging) files in directory | saminfo.sh -f"$DIR" -Ccount |
You can provide placeholders if (and only if) you quote correctly. E.g.,
ssh hsm.dmawi.de "saminfo.sh -Cc -f '/hs/D-A/platforms/vessel/polarstern/parasound_p70/exdata/PS138/PHF2309162*' "
(Note: This is not implemented for multiple ScoutFS, yet. If you think you really need this, contact us and if we have time left, we start implementing this.)
You can process multiple files with ssh:
The RestAPI and saminfo.sh -g[s|a] provide file information as flags. You can decode them by adding -v1 to saminfo.sh or take a look into this table:
0 | (00000000) | No flags |
1 | (00000001) | Staging - File requested to stage |
2 | (00000010) | StageFail - All copies failed to stage |
4 | (00000100) | NoArchive - No archive copies of file should be made |
8 | (00001000) | ExtCacheRequested - Policy requests extended cache |
16 | (00010000) | ExtCacheDone - Extended cache copy created already |
32 | (00100000) | ReleaseNever - Never release automatically |