centralised configuration to config.rb
This commit is contained in:
parent
e1b5259ba6
commit
beb2e8a428
6
config.rb
Normal file
6
config.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
RES_BASE = "https://strawberry.thedevcave.net/~christoffermadsen/"
|
||||
USERNAMES = ["christoffermadsen","jmaa","jacob","alexander"]
|
||||
SHOT_DIR = "/var/shots/"
|
||||
ERB_FILE = "dcav-index.erb"
|
||||
HTML_FILE = "/var/shots/html/index.html"
|
||||
LOG_DIR = "./log/"
|
11
gen_index.rb
11
gen_index.rb
|
@ -1,11 +1,12 @@
|
|||
require 'erb'
|
||||
require 'filesize'
|
||||
|
||||
RES_BASE = "https://strawberry.thedevcave.net/~christoffermadsen/"
|
||||
usernames = ["christoffermadsen","jmaa","jacob","alexander"]
|
||||
shot_dir = "/var/shots/"
|
||||
erb_file = "dcav-index.erb"
|
||||
html_file = "/var/shots/html/index.html"
|
||||
load 'config.rb'
|
||||
|
||||
usernames = USERNAMES
|
||||
shot_dir = SHOT_DIR
|
||||
erb_file = ERB_FILE
|
||||
html_file = HTML_FILE
|
||||
|
||||
class User
|
||||
attr_accessor :name, :count, :size, :avgsize
|
||||
|
|
10
plot.rb
10
plot.rb
|
@ -1,11 +1,15 @@
|
|||
# coding: utf-8
|
||||
users = ["christoffermadsen","jmaa","jacob","alexander"]
|
||||
colors = {}
|
||||
load 'config.rb'
|
||||
|
||||
users = USERNAMES
|
||||
log_dir = LOG_DIR
|
||||
|
||||
colors = {}
|
||||
|
||||
users.each do |user|
|
||||
colors[user] = "%06x" % (rand * 0xffffff)
|
||||
end
|
||||
log_dir = "./log/"
|
||||
|
||||
plotstring = %Q[set terminal 'svg' size 800,400 fname 'Verdana, Helvetica, Arial, sans-serif' \
|
||||
fsize '14' rounded dashed
|
||||
set key bottom center outside horizontal
|
||||
|
|
17
update.rb
17
update.rb
|
@ -1,15 +1,18 @@
|
|||
users = ["christoffermadsen","jmaa","alexander","jacob"]
|
||||
shot_dir = "/var/shots/"
|
||||
log_dir = "./log/"
|
||||
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`
|
||||
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
|
||||
|
||||
output = File.open("#{log_dir}/#{user}.log","a")
|
||||
output << "#{Time.now.to_i} #{count} #{size}\n"
|
||||
output.close
|
||||
File.open("#{log_dir}/#{user}.log","a") do |f|
|
||||
f << "#{Time.now.to_i} #{count} #{size}\n"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user