#!/bin/ksh # # DMCL # # A script to create a directory on the local disk of each DMCL host, # and a "hostname" symbolic link to access the directory via the # automounter (i.e., for host named "a" and a user named "b", create # a directory a:/export/suburbia/b and a symbolic link # a->/net/a/export/suburbia/b). This also creates a link # burbs->/export/suburbia/b. # # Note 1. This may take several minutes to execute, since it tries # to access hardwareless hostnames and experiences a timeout delay. # # Note 2. As machines are reinstalled or hardware is added for currently # unused hostnames, you will need to rerun this script. # # Note 3. At last count, this creates 18 of a possible 45 links. Consider # trimming the list of hostnames to those you use. # dmclHostList=' akash antrix anuradha ardra ashadha ashlesha ashwini bhadra bharani bhaskara bhramand buddh chandra chitra dhanistha dhruva guru hasta jyestha ketu kiran krutika magha mangal megha mriga mula prithvi punarvasu pushyami rahu revati rohini phalgun satabhisa shagun shani shravan shukra som suhasini surya swati vishakha ' ## ## Subroutines ## yesOrNo() # Prompts for y/n response # Globals: # yesOrNoReply contains y or n after return # Arguments: # 1 prompt string { unset yesOrNoReply while [ X${yesOrNoReply} != 'Xy' -a X${yesOrNoReply} != 'Xn' ] do print -n "$1 " read yesOrNoReply?'(y)/n ' ; if [ -z ${yesOrNoReply} ] ; then yesOrNoReply='y' ; fi if [ X${yesOrNoReply} = 'XY' ] ; then yesOrNoReply='y' elif [ X${yesOrNoReply} = 'XN' ] ; then yesOrNoReply='n' ; fi done } currentDir=`pwd` yesOrNo "Create links to suburbia in ${currentDir}?" createReply=${yesOrNoReply} dmclUser=`logname` if [ X${createReply} = 'Xy' ] then for host in ${dmclHostList} do newDir=/net/${host}/export/suburbia/${dmclUser} `mkdir -p ${newDir} >/dev/null 2>&1` \ && `rm -f ${host} ; ln -s ${newDir} ${host}` done rm -f burbs newDir=/export/suburbia/${dmclUser} `mkdir -p ${newDir} >/dev/null 2>&1` \ && `rm -f ${host} ; ln -s ${newDir} burbs` fi ;