自动同步服务器vm文件的shell脚本

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

    #!/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