Difference between revisions of "Script Prototypes"

From Nuclear Physics Group Documentation Pages
Jump to navigationJump to search
(Page for prototypes of functions/scripts/programs that automate tasks)
 
Line 7: Line 7:
 
     scp $master root@$1:/etc/resolv.conf
 
     scp $master root@$1:/etc/resolv.conf
 
}</pre>
 
}</pre>
Would be better if the function checked to see if the file didn't exist, and if not, created it.  Or maybe it would be better to have the "master" file on a specific machine.
+
Would be better if the function checked to see if the file didn't exist, and if not, created it.  Or maybe it would be better to have the "master" file on a specific machine.  Actually, even better would be a program that maps settings to files.

Revision as of 13:56, 20 July 2007

setres

Bash function for remotely setting /etc/resolv.conf to the proper values:

function setres
{
    home=~
    master="$home/bin/master_resolv.conf"
    scp $master root@$1:/etc/resolv.conf
}

Would be better if the function checked to see if the file didn't exist, and if not, created it. Or maybe it would be better to have the "master" file on a specific machine. Actually, even better would be a program that maps settings to files.