From 143eb03be4aba6e740b7eb06886494590ece7d23 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 13 Jul 2005 04:00:14 +0000 Subject: [PATCH] Nuevo comando restart y crea/reestablece hosts y networks con up/down. --- makeroute | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/makeroute b/makeroute index 2316394..fd7b223 100755 --- a/makeroute +++ b/makeroute @@ -65,6 +65,10 @@ def up(host, fd): if ruta['metrica'] <> "0": print 'UP: route add -net %(ip)s gw %(gateway)s netmask %(mascara)s dev %(iface)s metric %(metrica)s' % ruta os.system('route add -net %(ip)s gw %(gateway)s netmask %(mascara)s dev %(iface)s metric %(metrica)s' % ruta) + os.system('cp /etc/hosts /etc/hosts.13.bak') + os.system('cp hosts /etc/hosts') + os.system('cp /etc/networks /etc/networks.13.bak') + os.system('cp networks /etc/networks') def down(host, fd): hosts = parse(fd) @@ -74,6 +78,8 @@ def down(host, fd): os.system('killall pppd') else: os.system('ifconfig %(iface)s down' % iface) + os.system('mv /etc/hosts.13.bak /etc/hosts') + os.system('mv /etc/networks.13.bak /etc/networks') def list(fd): hosts = parse(fd) @@ -89,6 +95,9 @@ if __name__ == '__main__': up(sys.argv[2], fd) elif sys.argv[1] == 'down': down(sys.argv[2], fd) + elif sys.argv[1] == 'restart': + down(sys.argv[2], fd) + up(sys.argv[2], file('routers_labo.csv')) elif sys.argv[1] == 'list': list(fd) -- 2.43.0