BackupPC-users

Re: [BackupPC-users] Using perl code within config files

2008-12-02 23:21:56
Subject: Re: [BackupPC-users] Using perl code within config files
From: "Jeffrey J. Kosowsky" <backuppc AT kosowsky DOT org>
To: "backuppc-users AT lists.sourceforge DOT net" <backuppc-users AT lists.sourceforge DOT net>
Date: Tue, 02 Dec 2008 23:19:17 -0500
Craig Barratt wrote at about 15:21:58 -0800 on Tuesday, December 2, 2008:
 > Jeffrey writes:
 > 
 > > Just as an FYI, it is possible to use perl code within config files so
 > > that you can use a single config file yet still customize
 > > configurations by pc (or groups of pc's) without having to duplicate
 > > changes across multiple relatively similar config files each time you
 > > change a parameter.
 > > 
 > > For example, I have a number of windows machines and one linux server.
 > > For the windows machines, I use a single config file in
 > > /etc/BackupPC/pc and then create links to it for each of my windows
 > > machines.
 > > 
 > > I then use perl conditional statements to make some configurations
 > > unique by pc (or group of pc's).
 > > 
 > > The trick is that $ARGV[0] is the name of the config file (or link)
 > > called and thus can be used to determine the machine.
 > > Personally, I find this trick very helpful...
 > 
 > Yes, a nice trick.  But there are two caveats:
 > 
 >   - the CGI editor won't preserve any of the in-line perl code

True, understandable, and probably unavoidable. But probably most
users who are at the level of adding inline perl code aren't use the
cgi editor anyway.

 >   - re-writing a config file (when upgrading with configure.pl and
 >     the CGI editor) might break since the in-line perl formatting
 >     might not be interpreted correctly.

Hopefully, the release notes will explain changes so that I can
correct things manually.

Also, I have been careful to keep my inline perl code to the
pc-specific config files in which I include only the small subset of
parameters that I need to vary by machine. So, presumably, the pain if
any at upgrade will be limited to those changes.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/