Skip to content

Instantly share code, notes, and snippets.

@wookietreiber
Created December 20, 2021 13:55
Show Gist options
  • Save wookietreiber/d5cceff4f008e6214fad6ee88305cac6 to your computer and use it in GitHub Desktop.
Save wookietreiber/d5cceff4f008e6214fad6ee88305cac6 to your computer and use it in GitHub Desktop.
spectrum scale afm cleanup
#!/bin/bash
input=$1
while read -r file
do
orig="$file"
neu="${file}.sonich42xxx"
echo "orig: $orig"
cp "$orig" "$neu" && rm -f "$orig" && mv "$neu" "$orig"
done < <(parallel mmclidecode :::: "$input")
#!/bin/bash
app=afm-fortmachen-of-doom
function eve_log_info {
if [[ -t 1 ]]
then
echo -e "\\e[1m$app: $*\\e[0m"
else
echo "$app: $*"
fi
}
# Prefixes message with `$app: ` and pretty-prints if STDERR is terminal.
#
# ## Arguments
#
# **$@**: message
function eve_log_error {
if [[ -t 2 ]]
then
echo -e "\\e[1m\\e[31m$app: $*\\e[0m" >&2
else
echo "$app: $*" >&2
fi
}
# Prints command to STDERR and runs it.
#
# ## Arguments
#
# **$@**: command
function eve_runlog_cmd {
if [[ -t 2 ]]
then
echo -e "\\e[1m$app: exec: $*\\e[0m" >&2
else
echo "$app: exec: $*" >&2
fi
"$@"
}
for fileset in $(mmafmctl gpfs1 getstate -Y | awk -F: '{ print $8 }' | grep "data_" | sort)
do
eve_log_info ">>> WIR STARTEN MIT DEM NÄCHSTEN AFM-BEDINGSTEN FILESET $fileset"
path=$(
mmlsfileset gpfs1 |
awk -v fileset="$fileset" 'NR > 2 && $1 == fileset { print $3 }'
)
eve_log_info ">>>>> DER PFAD HIER $path"
eve_log_info ">>>>> YES YES"
eve_runlog_cmd mmchfileset gpfs1 "$fileset" -p afmTarget=disable # yes yes
read -p ">>>>> TYPE \"yes\" ONLY IF EVERYTHING CACHED !!! " -r choice
if [[ $choice != yes ]]
then
eve_log_info ">>>>> NOCH UNGECACHETER MIST --> TRIGGER PREFETCH AND CONTINUE"
eve_log_error ">>>>> RUN THIS IN ANOTHER SESSION: mmafmctl gpfs1 prefetch -j $fileset --directory $path"
continue
fi
eve_runlog_cmd mmunlinkfileset gpfs1 "$fileset" # eventuell -f
eve_log_info ">>>>> YES NO"
eve_runlog_cmd mmchfileset gpfs1 "$fileset" -p afmTarget=disable # yes no
eve_runlog_cmd mmlinkfileset gpfs1 "$fileset" -J "$path"
eve_log_info ">>>>> SET QUOTA"
eve_runlog_cmd mmsetquota "gpfs1:$fileset" --block 4T:5T --files 5000000:20000000
eve_log_info ">>>>> STATUS"
eve_runlog_cmd mmlsfileset gpfs1 "$fileset" -L
eve_log_info ">>>>> FERDSCH"
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment