miércoles, 7 de enero de 2009

tired of modifying the explorer configuration file on a bunch of sun servers

When having a lot of sun servers to mantain, and we have a template to apply on all sun servers across your network perhaps this single line inside a for loop can help you out.
Using ssh with sudo and using regular expressions to help adapt your explorer configuration template file to every single sun server can be done in minutes in stead of days
your template must be copied to all servers before executing this line

"sudo ssh $host 'hi=`hostid`; cat /tmp/template|sed -e "s//tmp/newtemp;vers=`/usr/bin/pkginfo -l SUNWexplo | grep -i version | cut -f2 -d:|cut -f1 -d, | cut -f1 -d,|sed -e "s/ //g"`;cat /tmp/newtemp | sed -e "s/EXP_DEF_VERSION=\".\...\"/EXP_DEF_VERSION=\"$vers\"/g">/tmp/newtemp2;sn=`/usr/sbin/eeprom oem-banner | cut -f2 -d:`;cat /tmp/newtemp2 | sed -e "s/EXP_SERIAL_$hi=\"/EXP_SERIAL_$hi=\"$sn/g">/tmp/explorer.new; mv /etc/opt/SUNWexplo/default /etc/opt/SUNWexplo/default.old; mkdir /etc/opt/SUNWexplo/default; chmod 555 /etc/opt/SUNWexplo/default; cp -p /tmp/explorer.new /etc/opt/SUNWexplo/default/explorer'"

No hay comentarios:

Publicar un comentario