Check if mail address from UR1
This commit is contained in:
		
							parent
							
								
									b244cdd592
								
							
						
					
					
						commit
						65c4d3c5a2
					
				|  | @ -54,6 +54,7 @@ temp_fqdn=$(host ${ip} | cut -d' ' -f 5) | |||
| fqdn="${temp_fqdn%?}" | ||||
| hostname=$(echo ${fqdn} | cut -d'.' -f1) | ||||
| mail=$(grep "# mail:" ${config_pl_path} | cut -d':' -f 2) | ||||
| mail_ur1=$(echo ${mail} | cut -d'@' -f2) | ||||
| username=$(ldapsearch -ZZ -H ldap://ldap.univ-rennes1.fr -LLL '(mail='"${mail}"')' -b "dc=univ-rennes1,dc=fr" -x uid | grep "^uid" | cut -d" " -f2) | ||||
| 
 | ||||
| #printf "IP: ${ip}\n" | ||||
|  | @ -63,11 +64,19 @@ username=$(ldapsearch -ZZ -H ldap://ldap.univ-rennes1.fr -LLL '(mail='"${mail}"' | |||
| #printf "mail: ${mail}\n" | ||||
| #printf "username: ${username}\n" | ||||
| 
 | ||||
| #### TESTS #### | ||||
| # Check IP | ||||
| if [[ ${ip_ur1} != "129.20" ]]; then | ||||
|   printf "La machine cliente n'était pas sur le réseau UR1\n" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| # Check mail | ||||
| if [[ ${mail_ur1} != "univ-rennes1.fr" ]]; then | ||||
|   printf "Le client n'a pas renseigné une adresse UR1\n" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| #### AJOUTER L HÔTE DANS ${BACKUPPC_CONFIG_DIR}/HOSTS #### | ||||
| # jfade.pr079076.spm.univ-rennes1.fr	0	jfade | ||||
| if [[ ! $(grep "${username}.${hostname}" "${backuppc_host_file}") ]]; then | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue