1 class AdminToolController < ApplicationController
3 # uses basic *NIX tools to give quick stats on the server - tested on Linux and OSX
5 @status = "<pre><h1>Logged in users and uptime</h1>"
7 @status << "<h1>Status of disks</h1>"
9 @status << "<h1>Processes running</h1>"
10 @status << `ps ax`.gsub!("<","<") # even with <pre> this messes up HTML
14 # shows a pretty printed list of directories and sub-dirs
16 du_opt = (`uname` == "Darwin\n") ? "d0" : "-summarize"
17 @trash_size = `du -#{du_opt} -h #{TRASH_PATH}`.match(/(.*?)\t/)[1]
18 @ferret_size = `du -#{du_opt} -h #{FERRET_PATH}`.match(/(.*?)\t/)[1]
19 du_opt2 = (`uname` == "Darwin\n") ? "d2" : "-max-depth=2"
20 @folder_tree = `cd #{UPLOAD_PATH}; du -#{du_opt2} | sort -n`
24 @pages, @usages = paginate_collection(:per_page => 30, :page => params[:page]) do
26 @name = (params[:file] ? Myfile.find(params[:id]).filename : Folder.find(params[:id]).name )
27 (params[:file] ? Myfile : Folder).find(params[:id]).usages
29 Usage.find(:all,:order => "download_date_time desc")