Hi,
I made a little ruby script to parse bacula-dir.conf in order to generate a
list of jobs (in HTML) with the pathnames that is backed-up.
It's pretty simple, wilddir and wildfiles are ignored. Just the File = in
include and excludes.
Note that the bacula-dir.conf must be readeable by the webserver, which might
be a security issue.
I post it here incase someone can benefit. No help required this time ;)
Greetings,
Ger.
PS: Please delete the newlines that my client inserts.
--------------------%<------------------------
#!/usr/bin/ruby
#
# This script shows what is configured to be backupped on each machine.
#
FILENAAM = String.new("/etc/bacula/bacula-dir.conf");
class ConfParser
def getJobs
@jobs = Array.new #Create Array to hold jobs
file = File.new(::FILENAAM, "r")
while (temp = file.gets)
# Detect start of Job-block
if (temp[/^Job /])
# Make Job object with settings
job = Job.new()
job.fulljob = String.new
while ((temp = file.gets) && !(temp[/^\}/]))
job.fulljob += temp
case temp
when /Name = (.*)/
job.jobname = $1
when /Client = (.*)/
job.clientname = $1
when /FileSet = (.*)/
job.filesetname = $1
end
end
@jobs.push(job) if not (job.jobname[/Catalog/] ||
job.jobname[/Restore/])
end
#After Job block
end
file.close
#Return array of Job objects
@jobs
end
end
class Job
attr_accessor :jobname, :clientname, :filesetname, :fulljob
def getFileSet
@includeset = Array.new #Create Array to hold Includes
@excludeset = Array.new #Create Array to hold Excludes
file = File.new(::FILENAAM, "r")
while ((temp = file.gets) && !(temp[/Name = #{filesetname}/]))
end
while ((temp = file.gets) && !(temp[/File = (.*)/]))
end
@includeset.push($1)
while ((temp = file.gets) && !(temp[/\}/]))
unless (temp[/#/])
temp[/File = (.*)/]
@includeset.push($1)
end
end
if ((temp = file.gets) && (temp[/Exclude/]))
while ((temp = file.gets) && !(temp[/\}/]))
unless (temp[/#/])
temp[/File = (.*)/]
@excludeset.push($1)
end
end
end
return @includeset, @excludeset
end
end
print "Content-type: text/html\r\n\r\n"
print "<html><head><title>Lijst van Bacula</title></head><body>"
print "Dit is de lijst met backup-jobs met erbij wat er ge-backupped wordt."
print "<br>Controleer svp wat er van jouw pc wordt gebackupped, alsmede de
servers"
print "<br>waar jij mee te maken hebt.<br><br>"
conf = ConfParser.new
@jobs = conf.getJobs
@jobs.each do |job|
#job = @jobs[29]
print "<table border=1><tr><th colspan=2>#{job.jobname}</th></tr>"
@includeset, @excludeset = job.getFileSet
print "<tr><td>INCLUDES:</td><td width=300>"
@includeset.each do |includes|
print includes + "<BR>"
end
print "</td></tr>"
print "<tr><td>EXCLUDES:</td><td>"
@excludeset.each do |excludes|
print excludes + "<BR>"
end
print "</td></tr></table>"
end
print "</html></body>"
--------------------%<------------------------
--
ARGOSS: your partner for atmospheric, marine & coastal information
P O Box 61
8325ZH Vollenhove The Netherlands
tel +31-527-242299 fax +31-527-242016
Web http://www.argoss.nl
Confidentiality Notice & Disclaimer
The contents of this e-mail and any attachments are intended only for the
use of the e-mail addressee(s) shown. If you are not that person, or one of
those persons, you are not allowed to take any action based upon it or to
copy it, forward, distribute or disclose the contents of it and you should
please delete it from your system.
ARGOSS Holding BV and its subsidiaries do not accept any liability for any
errors or omissions in the context of this e-mail or its attachments which
arise as a result of Internet transmission, nor accept liability for
statements which are those of the author and not clearly made on behalf of
ARGOSS.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users