dcav-stats/update.rb

19 lines
407 B
Ruby
Raw Normal View History

2017-05-09 11:40:42 +00:00
load 'config.rb'
users = USERNAMES
shot_dir = SHOT_DIR
log_dir = LOG_DIR
2017-01-24 16:09:09 +00:00
users.each do |user|
2017-05-09 11:40:42 +00:00
size = `du -B1 #{shot_dir}#{user}/ | awk {'print $1'} | head -n 1`
2017-10-13 16:54:32 +00:00
count = `find #{shot_dir}#{user}/ -maxdepth 1 -type f | wc -l | head -n 1`
[size,count].each do |x|
x.delete! "\n"
end
2017-01-26 15:08:01 +00:00
2017-05-09 11:40:42 +00:00
File.open("#{log_dir}/#{user}.log","a") do |f|
f << "#{Time.now.to_i} #{count} #{size}\n"
end
2017-01-24 16:09:09 +00:00
end