Er...It's my fault not explaining my demands clearly... I want to use cfengine3 to set my hostname which contains a part of the ip address... The only way i can find is using shell script to "grep" it from the output of "ifconfig", and someone tells me in cfengine2 there is a builtin variable so i want to know if there is also a simple way in cfengine3?
2009/12/16 Andreas Dan Larsson <andreas.d.lars...@axis.com> > > > HI, everyone, is there a way to get local ip address in cfengine3? > > Hi, > > You could use the builtin variable for hostname $(sys.fqhost) and use that > to get the ip from you nameservice > > Perhaps something in the lines of: > > "ip" string => execresult("host $(sys.fqhost) | sed -ne 's/$(sys.fqhost) > has address ([.0-9]+)/\1/p' ","useshell") > > This ofcourse only works if you can resolv the host in dns. Im sure others > will object if this is a inappropriate method for determining ip address. :) > > /Andreas Larsson > > > > -- SA,专注于系统管理
_______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine