Skip to content

Instantly share code, notes, and snippets.

@sbamin
Created January 23, 2022 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbamin/846658509ff574184028a94ef0dd8687 to your computer and use it in GitHub Desktop.
Save sbamin/846658509ff574184028a94ef0dd8687 to your computer and use it in GitHub Desktop.
Check disk quota prior to running workflows with 100s of jobs in queue
#!/usr/bin/env bash
## following will prevent running of queued jobs if tier 1 space is > 99 %
tstamp="$(date +%d%b%y_%H%M%S_%Z)"
## available files: tier1state.txt, tier2state.txt, faststate.txt
## These files updates every 30 min per disk status.
diskstat=$(cat /projects/verhaak-lab/verhaak_env/SetEnv/logs/diskstats/tier1state.txt)
diskstat=${diskstat:-"NA"}
if [[ "${diskstat}" -ge 99 ]]; then
printf "ERR\t%s\tTier 1 space is almost full. Exiting now!\tdisk_pct: %s" "${tstamp}" "${diskstat}"
exit 1
else
echo "All good to go and startin a job!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment