Deployment scripting features on production

Source: Internet
Author: User

#!/bin/Bash#author by jackluo# file to filter excludefile=(api.md dev.md. git. Gitignore. htaccess. Project readme.md) #定义要copy的目录new_git_code_dir=/data/projects/your own git repository pathProduction_code_dir=/data/projects/you produce the above path/#检查这个字段是否存在这个数组中functionIn_array () {local F=($1) Local A=($2)     forIinch${a[*]}; Do#检查是否在在过滤文件中, on the return1, not on the return0        if[[$i = $f]]; Thenreturn1; fi     Done}CD $new _git_code_dirEcho "Pull Replace code ..."Start=$(Date+%s) git pullend=$(Date+%s) Time=$ ($end-$start))Echo "Code Pull Complete ... It took $time seconds to finish."#列出目录中所有的文件LISTDIR=`ls$new _git_code_dir 'Echo "start copying code ..."Start=$(Date+%s) forDinch$LISTDIR; Do#检查是不在拷的范围内 In_array"$d" "${excludefile[*]}"    if[[  $? =1]] ; ThenContinueElse       Echo "being handcuffed $d ..."/bin/CP-A ${new_git_code_dir}/$d ${production_code_dir}fi DoneEnd=$(Date+%s) Time=$ ($end-$start))Echo "Copy Code Complete ... It took $time seconds to finish."Echo "Change directory Permissions ..."ChownFPM:FPM ${production_code_dir}-R &>/dev/NULLEcho "Deployment Complete"

Deployment scripting features on production

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.