dcav-stats/update.rb

15 lines
422 B
Ruby
Raw Normal View History

2017-01-24 16:09:09 +00:00
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`
count = `ls -1 #{shot_dir}#{user}/ | wc -l | head -n 1`
[size,count].each do |x|
x.delete! "\n"
end
2017-01-24 16:09:09 +00:00
output = File.open("#{log_dir}/#{user}.log","a")
output << "#{Time.now.to_i} #{count} #{size}\n"
output.close
end