A simple hook Demo: You can also search the Internet for other advanced
This time to achieve the function is: each time the user commits to the warehouse, the warehouse hook will automatically put the program and update the www/Web publishing directory
1. Now create a test.com site directory under the web directory
[Email protected] ~]# cd/var/www/html/[email protected] html]# svn checkout svn://localhost/test.comAuthentication Realm: <SVN://localhost:3690> 59865037-2557-40be-aa97-d460f66b4c60Password for 'Root': Authentication Realm:<SVN://localhost:3690> 59865037-2557-40be-aa97-d460f66b4c60Username:wentaopassword for 'Wentao': -----------------------------------------------------------------------ATTENTION! Your Password forAuthentication Realm:<SVN://localhost:3690> 59865037-2557-40be-aa97-d460f66b4c60can only is stored to disk unencrypted!You is advised to Configureyour system so that Subversion can store passwords encrypted,ifpossible. See the documentation fordetails. You can avoid future appearances of this warning by setting the valueof the'Store-plaintext-passwords'Option to either'Yes'Or'No' inch'/root/.subversion/servers'.-----------------------------------------------------------------------Store Password unencrypted (yes/no)?YA test.com/2. Txta test.com/3. Txta test.com/TEST.PHPA test.com/1. phpchecked Out Revision8. [Email protected] html]#
Follow the prompts to enter the root password, and the SVN authorization username and password
Then configure the script for the Hook folder
[Email protected] hooks]#pwd/root/svnrepo/test.com/Hooks[[email protected] hooks]# lltotal $-rw-r--r--.1Root root1977Mar in ,: -Post-Commit.tmpl-rw-r--r--.1Root root1638Mar in ,: -Post-Lock.tmpl-rw-r--r--.1Root root2289Mar in ,: -post-revprop-Change.tmpl-rw-r--r--.1Root root1567Mar in ,: -Post-Unlock.tmpl-rw-r--r--.1Root root3426Mar in ,: -Pre-Commit.tmpl-rw-r--r--.1Root root2434Mar in ,: -Pre-Lock.tmpl-rw-r--r--.1Root root2786Mar in ,: -pre-revprop-Change.tmpl-rw-r--r--.1Root root2122Mar in ,: -Pre-Unlock.tmpl-rw-r--r--.1Root root2780Mar in ,: -start-Commit.tmpl[[email protected] hooks]#
Change the following hook file template to an executable file
CP Post-commit.tmpl post-chmod +x post-
Vim Post-commit Add the following:
Export Lang=en_us. UTF-8
/USR/BIN/SVN update/var/www/html/test.com--username Wentao--password 123456
Web Publishing Directory Synchronization update
SVN Hook operation-Update web directory synchronously