Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'rubygems'
- require 'active_record'
- require 'pathname'
- # Config
- server = 3 #chuck3
- webalizer = "/usr/local/bin/webalizer"
- logfile = "access_log"
- # Don't edit below..
- class Site < ActiveRecord::Base
- has_one :option
- end
- class Option < Site
- set_table_name 'options'
- end
- # Connect!
- ActiveRecord::Base.establish_connection({
- :adapter => 'mysql',
- :database => 'hosting',
- :host => 'chuck.nsn.no',
- :username => 'chuck2',
- :password => 'hohoho',
- })
- sites = Site.find(:all, :include => :option, :conditions => ['options.access_log = "on" and server = ?',server])
- sites.each do |s|
- logdir = s.homedir "/logs"
- statsdir = s.homedir "/web/stats"
- #make sure logdir exists
- Pathname.new(logdir).mkpath
- Pathname.new(statsdir).mkpath
- #webalize it!
- system("#{webalizer} -p -n '#{s.servername}' -C 0 -o #{statsdir} #{logdir}/#{logfile}")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement