IP:172.16.14.6(主) 172.16.17.2(從)17.2 安裝svnbash
[root@iz2 ~]# yum install subversion -y [root@iz2 hooks]# cat /usr/lib/systemd/system/svnserve.service [Unit] Description=Subversion protocol daemon After=syslog.target network.target [Service] Type=forking EnvironmentFile=/etc/sysconfig/svnserve ExecStart=/usr/bin/svnserve -d --config-file=/data/svn/svnserver.conf --pid-file=/run/svnserve/svnserve.pid $OPTIONS [Install] WantedBy=multi-user.target [root@iz2 ~]# systemctl daemon-reload [root@iz2 ~]# systemctl start svnserve.service Job for svnserve.service failed because the control process exited with error code. See "systemctl status svnserve.service" and "journalctl -xe" for details. [root@iz2z ~]# systemctl status svnserve.service ● svnserve.service - Subversion protocol daemon Loaded: loaded (/usr/lib/systemd/system/svnserve.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2020-05-08 14:15:58 CST; 10s ago Process: 29000 ExecStart=/usr/bin/svnserve -d --config-file=/data/svn/svnserver.conf --pid-file=/run/svnserve/svnserve.pid $OPTIONS (code=exited, status=1/FAILURE) May 08 14:15:58 iz2ze8ip0m748wp4lnu6piz systemd[1]: Starting Subversion protocol daemon... May 08 14:15:58 iz2ze8ip0m748wp4lnu6piz svnserve[29000]: svnserve: Root path '/var/svn' does not exist or is not a directory. //沒有svn的家目錄 May 08 14:15:58 iz2ze8ip0m748wp4lnu6piz systemd[1]: svnserve.service: control process exited, code=exited status=1 May 08 14:15:58 iz2ze8ip0m748wp4lnu6piz systemd[1]: Failed to start Subversion protocol daemon. May 08 14:15:58 iz2ze8ip0m748wp4lnu6piz systemd[1]: Unit svnserve.service entered failed state. May 08 14:15:58 iz2ze8ip0m748wp4lnu6piz systemd[1]: svnserve.service failed. [root@iz2z ~]# systemctl restart svnserve.service Job for svnserve.service failed because the control process exited with error code. See "systemctl status svnserve.service" and "journalctl -xe" for details. [root@iz2z ~]# svnadmin create /data/svn/develop/ [root@iz2z ~]# systemctl restart svnserve.service Job for svnserve.service failed because the control process exited with error code. See "systemctl status svnserve.service" and "journalctl -xe" for details. [root@iz2z hooks]# cat /etc/sysconfig/svnserve # OPTIONS is used to pass command-line arguments to svnserve. # # Specify the repository location in -r parameter: OPTIONS="-r /data/svn" ##修改svn root path [root@iz2 ~]# systemctl restart svnserve.service
須要在主服務機器配置 hook
[root@iz2z hooks]# pwd /data/svn/develop/hooks [root@iz2zecs69qbuuy757q805kz hooks]# ls post-commit post-commit.tmpl post-lock.tmpl post-revprop-change.tmpl post-unlock.tmpl pre-commit.tmpl pre-lock.tmpl pre-revprop-change pre-revprop-change.tmpl pre-unlock.tmpl start-commit.tmpl [root@iz2z hooks]# cat post-commit #!/bin/bash REPOS="$1" REV="$2" mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf svnsync sync svn://172.16.17.2/develop
重啓服務後 當出現 以下報錯
[root@iz2z hooks]# ls post-commit post-commit.tmpl post-lock.tmpl post-revprop-change.tmpl post-unlock.tmpl pre-commit.tmpl pre-lock.tmpl pre-revprop-change pre-revprop-change.tmpl pre-unlock.tmpl start-commit.tmpl [root@iz2zecs69qbuuy757q805kz hooks]# cat pre-revprop-change #! /bin/sh exit 0 [root@iz2z ~]# chmod +x pre-revprop-change [root@iz2z ~]# systemctl restart svnserve.service
在14.6(主) : svnsync sync svn://172.16.17.2/developsvn