private void createResolveConf() { ShellFilePrinter printer = new ShellFilePrinter("/etc/resolv.conf"); printer.out("search idea"); printer.out("nameserver 10.2.2.21"); printer.out("nameserver 10.2.2.22"); printer.close(); }
private void createHosts(String aHostname) { ShellFilePrinter printer = new ShellFilePrinter("/etc/hosts"); printer.out("127.0.0.1 localhost localhost.localdomain"); printer.out("127.0.0.1 %s", aHostname); printer.out("::1 localhost ip6-localhost ip6-loopback"); printer.out("ff02::1 ip6-allnodes"); printer.out("ff02::2 ip6-allrouters"); printer.close(); }
private void showIfcfg(String aHost, String aInterfaceName) { THost host = dao.getHostByName(aHost); TInterface iface = findInterface(host, aInterfaceName); Printer.out("# %s", aHost + " " + aInterfaceName); ShellFilePrinter printer = new ShellFilePrinter("/etc/network/interfaces.d/" + aInterfaceName); printer.out("auto %s", aInterfaceName); printer.out("iface %s inet static", aInterfaceName); printer.out("address %s", findIpAddress(host, aInterfaceName)); printer.out("netmask %s", iface.getLongNetmask()); printer.out("gateway %s", host.gw); printer.close(); }
private void createHostname(String aHost) { Printer.out("hostname " + aHost); ShellFilePrinter printer = new ShellFilePrinter("/etc/hostname"); printer.out(aHost); printer.close(); }