Skip to content

Instantly share code, notes, and snippets.

@dvanders
Created July 10, 2025 21:08
Show Gist options
  • Save dvanders/367c5dd82fbacbd764ee654d7100d600 to your computer and use it in GitHub Desktop.
Save dvanders/367c5dd82fbacbd764ee654d7100d600 to your computer and use it in GitHub Desktop.
#!/bin/bash
# random sleep to avoid thundering herd
sleep $[ ( $RANDOM % 30 ) + 1 ]s
if ls /sys/kernel/debug/ceph/*/caps 1> /dev/null 2>&1; then
CAPS=`cat /sys/kernel/debug/ceph/*/caps | grep total | awk '{sum += $2} END {print sum}'`
else
CAPS=0
fi
if [ "${CAPS}" -gt 10000 ]; then
logger -t ceph-drop-caps "Dropping ${CAPS} caps..."
echo 2 > /proc/sys/vm/drop_caches
logger -t ceph-drop-caps "Done"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment