On 08/02/10 13:17, Daniel beas wrote: > > Hi to all. > I have a dsl connection with a dynamic ip and actually i'm resolving it > with a subdomain from no-ip but sometimes i get this error > gethostbyname() for host "mydomain.zapto.org" failed: > ERR=Non-authoritative for host not found, or ServerFail. > So i'm trying to change the way i get the ip for the Storage daemon by > getting my public ip with a shell script (ran before the job) and > putting it in a variable. > > IP=`wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address://' > -e 's/<.*$//'` > > The problem i have is how can bacula-dir.conf get the $IP variable? > > i tried just this way but it doesn work > Storage { > Name = sxxx > Address = $IP > SDPort = 9103 > Password = "SHexZ8mwXW4YkbJgu2HpJloZfkuT5Pj5yyWLiPxBhoZy" > device = dxxx > Media type = File > } > > and then tried using brackets this way > Storage { > Name = sxxx > Address = {$IP} > SDPort = 9103 > Password = "SHexZ8mwXW4YkbJgu2HpJloZfkuT5Pj5yyWLiPxBhoZy" > device = dxxx > Media type = File > } > but looks like bacula thinks there finish the storage resource
Well, that latter syntax would be wrong for shell expansion; it would be ${IP}, not {$IP}. But correct shell expansion is moot in the first place because Bacula does not perform shell expansion when loading its config files. About the only practical way you can do this is to maintain a template config, generate a "live" config by processing the template and replacing the IP, then starting Bacula on the live config. So you'd do something like this: # bacula-dir.template Storage { Name = sxxx Address = MYADDRESS SDPort = 9103 Password = "SHexZ8mwXW4YkbJgu2HpJloZfkuT5Pj5yyWLiPxBhoZy" device = dxxx Media type = File } # prepscript #!/bin/bash IP=$(whatever means to get IP here) cat bacula-dir.template | sed -e "s/MYADDRESS/${IP}/" > bacula-dir.conf /etc/init.d/bacula start This step could probably actually be incorporated into your Bacula startup script. You're also going to have to make your Director and your storage daemon listen on both your internal address and your public IP, unless your router is taking care of this via NAT. All this said, I can't help but think there has to be an easier way to do this, but it's hard to tell without knowing what your actual infrastructure situation is. Do I understand correctly that you are trying to make backups, over DSL, to a remote storage host on a dynamic-IP connection somewhere off in the outside world? Or are you trying to back up remote clients to a local storage daemon over a dynamic-IP DSL connection? Either way seems likely to be both extremely unreliable and, more likely than not, infeasibly slow. -- Phil Stracchino, CDK#2 DoD#299792458 ICBM: 43.5607, -71.355 ala...@caerllewys.net ala...@metrocast.net p...@co.ordinate.org Renaissance Man, Unix ronin, Perl hacker, Free Stater It's not the years, it's the mileage. ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users