Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

James Robertson http://www.r0bertson.co.uk

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Monitor disk usage with a simple Ruby script

   1  
   2  dev = 'sda1'
   3  report = `df -h`
   4  disk_remaining = report[/sda\w+\s+\d+?.?\dG\s+\d+?.?\dG\s+(\d+.?\d+?G)/,1]
   5  puts "running low on disk space (#{dev}: #{disk_remaining })" if disk_remaining.to_i < 3
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS