From a324a3217c7a775a29dfb3b43f6f36bfb07d2c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20M=C3=BCller=20Madsen?= Date: Tue, 24 Jan 2017 17:09:09 +0100 Subject: [PATCH] initial commit --- plot.rb | 18 ++++++++++++++++++ update.rb | 15 +++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 plot.rb create mode 100644 update.rb diff --git a/plot.rb b/plot.rb new file mode 100644 index 0000000..dfd40e5 --- /dev/null +++ b/plot.rb @@ -0,0 +1,18 @@ +users = ["christoffermadsen","jmaa","jacob","alexander"] +log_dir = "./log/" +plotstring = %Q[set terminal 'png' +set output "/home/christoffermadsen/public_html/img/screenshot_count.png" +set title "Screenshot Count" +set key left box +set xdata time +set timefmt "%s" +set format x "%m/%d" +set yrange [0:500] +plot ] + +users.each do |user| + plotstring += %Q["log/#{user}.log" using 1:2 with lines, \\\n] +end +output = File.open("plotscript","w") +output << plotstring +output.close diff --git a/update.rb b/update.rb new file mode 100644 index 0000000..b5eb890 --- /dev/null +++ b/update.rb @@ -0,0 +1,15 @@ +users = ["christoffermadsen","jmaa","alexander","jacob"] +shot_dir = "/var/shots/" +log_dir = "./log/" +users.each do |user| + size = `du -B1 #{shot_dir}#{user}/ | awk {'print $1'} | head -n 1` + size.delete! "\n" + count = `ls -1 #{shot_dir}#{user}/ | wc -l | head -n 1` + count.delete! "\n" + + output = File.open("#{log_dir}/#{user}.log","a") + output << "#{Time.now.to_i} #{count} #{size}\n" + output.close + + puts "#{user} has size #{size} with #{count} screenshots" +end