Bacula-users

Re: [Bacula-users] Read all config files in a directory

2008-05-30 10:49:12
Subject: Re: [Bacula-users] Read all config files in a directory
From: Jeff Dickens <jeff AT m2.seamanpaper DOT com>
To: bacula-users <bacula-users AT lists.sourceforge DOT net>
Date: Fri, 30 May 2008 10:49:04 -0400
I was playing with a combination of includes with "@|" and using m4 to generate the included files.

Ex:
# more gen_clients.sh
#!/bin/sh
m4 -D CLIENTNAME="kestrel" \
        -D CLIENTPASS="PFV8i2UZ1c:p=47ZG5@Tc5pLmxFw04TaOaqa;MgDO;Mv" \
        /etc/bacula/conf/clients/fd2.m4
fd2.m4 is a client config with the symbols CLIENTNAME and CLIENTPASS substituted in to define the client, jobs, disk storage and disk storage pools.

Ex:
Client {
  Name = CLIENTNAME-fd
  Address = CLIENTNAME
  FDPort = 9102
  Password = "CLIENTPASS"
  .
  .
}

Job {
  Name = CLIENTNAME
  .
  .
  .
The shell script that calls m4 can be included into bacula-dir.conf with "@|".  I got busy and didn't finish the job.  I'll have to make some time to do it since it would reduce the number of config files I have to maintain to a small fraction of what I have now.  The sd(s) can also be configured with this trick.

That's not a real password, of course.  Btw I generate new passwords like this:
# more 44rand.pl
#!/usr/bin/perl -w
for (1..44) {
  $s .= chr(int(rand(75))+48);
}
print $s . "\n";

Not exactly cryptographically strong, but better than making them guessable or all the same.

Silver Salonen wrote:
On Tuesday 29 April 2008 02:58, Arno Lehmann wrote:
  
IIRC, you could also use an include like "|cat /etc/bacula/dir/*.conf" 
- I haven't treid that myself, and it's possible you need to use a 
shell and add more quoting, like in "|/bin/sh -c '/bin/cat 
/etc/bacula/dir/*.conf'" or something.
    
Yup, it is possible indeed. I just tested it with a simple script:
#!/bin/sh
cat /usr/local/etc/bacula/$1/*.conf

..and then included all my clients into the configuration:
@|"/usr/local/etc/bacula/sh/catConfig.sh client"

So keeping configuration in MySQL is not a problem at all.. gooood :)

--
Silver

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
  

Attachment: jeff.vcf
Description: Vcard

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
<Prev in Thread] Current Thread [Next in Thread>
  • Re: [Bacula-users] Read all config files in a directory, Jeff Dickens <=