Add a judgment in trustme.sh 47/27047/4
authorzhuzeyu <zhu.zeyu@zte.com.cn>
Mon, 16 Jan 2017 12:31:53 +0000 (20:31 +0800)
committerzhuzeyu <zhu.zeyu@zte.com.cn>
Mon, 6 Feb 2017 04:47:29 +0000 (12:47 +0800)
To check whether the script runs successful

Change-Id: I0ae4e01d845690cb6c19f95f0950cd98ebd1338c
Signed-off-by: zhuzeyu <zhu.zeyu@zte.com.cn>
deploy/trustme.sh

index a0414fd..38e2d83 100755 (executable)
@@ -48,7 +48,11 @@ fi
 
 #clear old public key
 print_log "clear old info in known_hosts file on localhost ..."
-ssh-keygen -R $ip
+test ! -f ~/.ssh/known_hosts || ssh-keygen -R $ip
+if [ $? != 0 ]; then
+  print_log "clear old info in known_hosts file on localhost failed"
+  exit 1
+fi
 
 #copy new public key
 print_log "copy my public key to $ip ..."