SVN sync to FTP shell script

Source: Internet
Author: User
Tags svn update egrep

#! /bin/bash

Action () {

#1, get SVN update output

/OPT/SVN/SVN/BIN/SVN update/opt/lampz/apache/web > File_out

#2, gets the number of rows through the output file File_out

line=$ (wc-l File_out|awk ' {print $} ')


#3, if the number of rows is greater than 2, there is an update or delete operation to get a list of files that need to be deleted or updated

if [[$line > 2]];then

Egrep-v ' Updating| updated| At ' file_out|egrep ' ^d ' |awk ' {print $} ' |awk-f ' web ' {print $} ' >file_delete #删除的文件列表

Egrep-v ' Updating| updated| At ' file_out|egrep-v ' D ' |awk ' {print $} ' >file_update #更新的文件列表

echo "Yes"

Else

echo "No Update"

Fi


#4, delete according to the File_delete file

For Del in $ (cat file_delete)

Do

/opt/ncftp3.2.5/bin/ncftp rm-u wangtao-p wt123321-p 62256 ${del#*web}

Done

#5, update operations based on the File_update file

For Update in $ (cat file_update)

Do

Path=${update#*web}

/opt/ncftp3.2.5/bin/ncftpput-u wangtao-p wt123321-p 62256 182.92.150.109/${path%/*} $Update

Done

}

while ((1))

Do

Action

Sleep 1

Done


SVN sync to FTP shell script

Related Article

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.