Skip to content

Instantly share code, notes, and snippets.

@ilyaevseev
Created July 3, 2015 12:47
Show Gist options
  • Save ilyaevseev/b568e35939353567444d to your computer and use it in GitHub Desktop.
Save ilyaevseev/b568e35939353567444d to your computer and use it in GitHub Desktop.
Check free space on server and in OpenVZ containers
#!/bin/sh
( df -h | tail -n +2
df -i | tail -n +2
awk '/^\/vz/ {print $2}' /proc/mounts | xargs -r df -h | tail -n +2
awk '/^\/vz/ {print $2}' /proc/mounts | xargs -r df -i | tail -n +2
) | grep -v ^none | egrep -v ' [ 1234567 ][0-9]% ' | sort | uniq \
| mail -E -s 'Check-df warning' admins
#!/bin/sh
( df -h | grep -v ^none | egrep -v ' [ 12345678][0-9]% ' | tail -n +2
df -i | grep -v ^none | egrep -v ' [ 1234567 ][0-9]% ' | tail -n +2
) | mail -E -s 'Check-df warning' admins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment