Created
November 15, 2012 01:39
Revisions
-
brianjolly created this gist
Nov 15, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/usr/local/bin/ruby log_file = "/var/log/mem_stats" date = `date`.rstrip mem_stats = `free -k`.split output = "" if Dir[log_file] == [] output << "date,\t total memory,\t used memory,\t free memory\n" end output << "#{date},\t #{mem_stats[7]}kb,\t #{mem_stats[8]}kb,\t #{mem_stats[9]}kb\n" File.open(log_file, 'a') {|f| f.write(output) }