dcav-stats/update.rb
2017-05-09 13:40:42 +02:00

19 lines
388 B
Ruby

load 'config.rb'
users = USERNAMES
shot_dir = SHOT_DIR
log_dir = LOG_DIR
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
File.open("#{log_dir}/#{user}.log","a") do |f|
f << "#{Time.now.to_i} #{count} #{size}\n"
end
end