first of all I need to say that I'm not a programmer, but I need to do something based on programming.... My problem is that I need to modify the DNS servers in almost 1000 nanostation equipments. I have access to them through ssh and I want to make a script to acomplish the task. I already made a file with the ip addresses of all CPE's (named client.txt). I think my script can begin like this:
#!/bin/bash
for host in $(cat client.txt);
do
ssh Administrador@$host sameforall;
sed 's/x.x.x.x/y.y.y.y /etc/resolve.conf;
sed 's/w.w.w.w/z.z.z.z /etc/resolve.conf;
# here I restart network service but I don't have the command yet
done
y.y.y.y
and z.z.z.z
are the new DNS servers and x.x.x.x
and w.w.w.w
the old ones
I know this is far away to be correct, but I need somebody help me. The first problem I'm going to find is that ssh prompts me to put the given servers ssh key to my known_hosts file, how can I solve this???
Can anybody please help me???