dcav-stats/update.rb
Christoffer Müller Madsen a324a3217c initial commit
2017-01-24 17:09:09 +01:00

16 lines
474 B
Ruby

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