.
[corvix.git] / opt / cluster / sbin / cl-refresh
blobd99a04d1012255c5a079c278708f9e2fc8c45199
1 #!/bin/zsh
3 # cat /etc/dhcp3/dhcpd.conf | awk '/host/&&/fixed-address/&&!/#/{gsub("host","");gsub("{","");gsub("}","");gsub("hardware","");gsub("ethernet","");gsub(";","");gsub("fixed-address","");host=$1;ip=$3}'
6 refresh_hosts() {
7 echo "Refresh hosts"
8 cat /etc/dhcp3/dhcpd.conf | awk '
9 /^[[:space:]]*#/{next}
10 /host /{n++;h[n]=$2}
11 /fixed-address/{match($0,/fixed-address[[:space:]]*[[:digit:].]*/,a);split(a[0],b);ip[n]=b[2]}
12 END{for(i=1;i<=n;i++)if(h[i]!~/b$/){print ip[i],h[i]}} '> /etc/hosts
13 echo "127.0.0.1 localhost" >> /etc/hosts
17 refresh_rgang() {
18 echo "Refresh rgang"
19 cat /etc/hosts | grep -v "a" | awk '{print$2}' | grep node > /opt/cluster/etc/rgang/nodes
20 cat /etc/hosts | awk '{print$2}' | grep nigol > /opt/cluster/etc/rgang/login
21 cat /etc/hosts | grep -v "a" | awk '{print$2}' > /opt/cluster/etc/rgang/all
24 refresh_torque() {
25 echo "Refresh torque"
26 cat /etc/hosts | grep node | awk '{print$2" np=4"}' > /opt/cluster/etc/queue/nodes
27 /etc/init.d/torque restart
28 rgang all /etc/init.d/torque restart
31 refresh_hosts
32 refresh_rgang
33 refresh_hosts
34 refresh_rgang
35 refresh_torque