Changeset 133
- Timestamp:
- Dec 28, 2017, 10:45:56 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tssh/tssh
r132 r133 122 122 fi 123 123 124 cluster=$(grep "^${host#*@}\b" ${HOME}/.csshrc | cut -f 2 -d '=') 124 # short host without login part if any 125 justhost=${host#*@} 126 127 cluster=$(grep "^${justhost}\b" ${HOME}/.csshrc | cut -f 2 -d '=') 125 128 if [ "${cluster}" == "" ] 126 129 then 130 # just a host to scan and add 127 131 if [ "${fast}" != 'yes' ] 128 132 then 129 # short host without login part if any130 if host ${ host#*@} | grep -q 'not found'133 # test if exists host 134 if host ${justhost} | grep -q 'not found' 131 135 then 132 [ "${verbose}" == "yes" ] && echo Warning: ${host#*@} does not exists136 [ "${verbose}" == 'yes' ] && echo Warning: ${justhost} does not exists 133 137 continue 134 138 fi 135 if ! nmap -p 22 -sT -PN ${ host#*@} | grep -q '\bopen\b'139 if ! nmap -p 22 -sT -PN ${justhost} | grep -q '\bopen\b' 136 140 then 137 if host ${ host#*@}.${dyn_domain} | grep -q 'not found' || ! nmap -p 22 -sT -PN ${host#*@}.${dyn_domain} | grep -q '\bopen\b'141 if host ${justhost}.${dyn_domain} | grep -q 'not found' || ! nmap -p 22 -sT -PN ${justhost}.${dyn_domain} | grep -q '\bopen\b' 138 142 then 139 [ "${verbose}" == "yes" ] && echo Warning: ${host#*@} is down143 [ "${verbose}" == 'yes' ] && echo Warning: ${justhost} is down 140 144 continue 141 145 else 142 host=${host#*@}.${dyn_domain} 143 ssh-keygen -q -R $(LANG=C host ${host#*@} | awk '{print $4}') 146 [ "${verbose}" == 'yes' ] && echo Warning: remove ssh key of ${justhost}.${dyn_domain} 147 host=${justhost}.${dyn_domain} 148 ssh-keygen -q -R $(LANG=C host ${justhost} | awk '{print $4}') 144 149 fi 145 150 fi 146 151 fi 152 [ "${verbose}" == 'yes' ] && echo Warning: add ${host} on list with mode ${mode} 147 153 echo "${host}" >> "/tmp/${base_path}/master${mode}" 148 154 else 155 # cluster, jump in a recursive mode 156 [ "${verbose}" == 'yes' ] && echo Warning: recursive mode for cluster ${cluster} with mode ${mode} 149 157 cluster=$(get_host_list "${cluster}${mode}") 150 158 fi
Note: See TracChangeset
for help on using the changeset viewer.