Here to introduce you to the Linux in the SVN submitted files automatically synchronized updates to the Site Directory I hope this article will help you.
Sometimes it can be cumbersome to upload to a server for multiple files, but if you use the SVN hook script it is easy to implement the local SVN submission, automatically synchronize the code files to the remote server's Web site directory without having to upload them manually.
First, checkout code in the site directory, such as my directory is/data/www/test
SVN Co https://127.0.0.1/test/trunk//data/www/test/
Note that this is because sometimes I will directly modify the code on the server, so with checkout, if not required, you can use export, this instruction does not take. SVN version of the file.
After moving out of the code, you need to create a hook script, my version library is placed under/data/svn/test/, create a new Post-commit script, add the following:
#!/bin/sh
Repos= "$"
rev= "$"
Export LANG=ZH_CN. UTF-8 #字符集, consistent with the server, can perform locale command view
SVN update/data/www/test/#更新svn
Echo ' Date ', ' WhoAmI ', $REPOS, $REV >>/data/svn/test/hooks/svn_hook.log # record time log
Chown-r Web:web/data/www/test # Change the site directory file to the owner if you are using the root user update
Give Script execution command: chmod +x/data/svn/test/hooks/post-commit
This completes the SVN commit Automatic Update synchronization code.