Skip to content

Instantly share code, notes, and snippets.

@smallfield
Created June 8, 2013 01:13
Show Gist options
  • Save smallfield/5733437 to your computer and use it in GitHub Desktop.
Save smallfield/5733437 to your computer and use it in GitHub Desktop.
dfでファイルシステムのusage監視して、古いファイル消していくやつ。
#!/bin/sh
targetdir=/tank/recorded/
targetfilesystem=tank
usage=`df | grep ^$targetfilesystem | awk '{print $5}' | sed 's/%//g'`
while [ $usage -gt 21 ]
do
rm -f "$targetdir`ls -t $targetdir | tail -n1`"
usage=`df | grep tank | awk '{print $5}' | sed 's/%//g'`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment