自動同步服務器vm文件的shell腳本

jopen 10年前發布 | 3K 次閱讀 Shell

    #!/bin/sh

if [ $# -lt 1 ]; then  
 echo "[FAILED]please input project name."  
else  
 if [ -d /home/admin/work/$1 ]; then  
  cd /home/admin/work/$1  
  svn up > files  
  find -name "files" -exec grep ".vm" {} \;|while read LINE  
  do  
   if [ -z "$LINE" ]; then  
    continue  
   fi  
   echo "find template changed : $LINE"  
   f="/home/admin/work/${1}/${LINE##* }"  
   t="/home/admin/${1}/target/${1}.war/${LINE##*web/src/main/webapp/}"  
   cp $f $t  
  done  
  echo "[SUCCESS]syn is ok."  
 else  
  echo "[FAILED] '$1' is not a project folder."  
 fi  
fi  
exit 0  </pre> 


 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!