본문 바로가기

목록이 없습니다.

[SVN] svn 서버 재시작(restart) 하는 방법

Server/Ubuntu
    반응형

     

    How to restart(or start) SVN server on Ubuntu?

     

    SVN 서버를 별도로 운영하고 있고 SVN 서버 관리자라면 이미 알고 있겠지만 혹여나 사내 관리자가 자리에 없을 경우에 SVN 서버를 다루지 않았던 사람이 단순하게 restart(또는 start)를 하는 것도 몰라서 찾아봐야할 때가 있습니다(그게 나야).

    저의 경우 SVN 서버가 설치된 컴퓨터가 클라우드로 되어 있지 않고 데스크탑 서버로 되어 있는데 이번에 정전이 일어나는 바람에 다운되었습니다. 컴퓨터를 다시 켜주고 아래 과정을 통해 다시 켜주었습니다.

     


    SVN 프로세스 종료(이미 꺼져있는 경우 생략)

    방법은 정말 간단합니다. 일단 restart를 하려면 먼저 돌고 있는 svn 프로세스가 있는지 확인하고 있다면 꺼줍니다.

     

    # ps -ef | grep svn
    root      4768     1  0 10:33 ?        00:00:00 svnserve -d -r /SVN
    # sudo kill 4768

    kill 명령어의 -9 옵션을 사용해도 되지만 굳이 사용하지 않은 이유는 -9 옵션의 경우 거의 그럴 확률은 없지만 강제종료 같은 느낌이라 프로세스가 종료될 때 혹시나 잘못될 수가 있기 때문에 -9 옵션을 선호하지 않습니다. (하지만 말을 안들으면 -9를 사용해서 강종해주어야합니다)

     

     

    svnserve 명령어 사용법 확인

    $ svnserve --help
    usage: svnserve [-d | -i | -t | -X] [options]
    Subversion repository server.
    Type 'svnserve --version' to see the program version.
    
    Valid options:
      -d [--daemon]            : daemon mode
      -i [--inetd]             : inetd mode
      -t [--tunnel]            : tunnel mode
      -X [--listen-once]       : listen-once mode (useful for debugging)
      -r [--root] ARG          : root of directory to serve
      -R [--read-only]         : force read only, overriding repository config file
      --config-file ARG        : read configuration from file ARG
      --listen-port ARG        : listen port. The default port is 3690.
                                 [mode: daemon, listen-once]
      --listen-host ARG        : listen hostname or IP address
                                 By default svnserve listens on all addresses.
                                 [mode: daemon, listen-once]
      -6 [--prefer-ipv6]       : prefer IPv6 when resolving the listen hostname
                                 [IPv4 is preferred by default. Using IPv4 and IPv6
                                 at the same time is not supported in daemon mode.
                                 Use inetd mode or tunnel mode if you need this.]
      -c [--compression] ARG   : compression level to use for network transmissions
                                 [0 .. no compression, 5 .. default,
                                  9 .. maximum compression]
      -M [--memory-cache-size] ARG : size of the extra in-memory cache in MB used to
                                 minimize redundant operations.
                                 Default is 16.
                                 0 switches to dynamically sized caches.
                                 [used for FSFS and FSX repositories only]
      --cache-txdeltas ARG     : enable or disable caching of deltas between older
                                 revisions.
                                 Default is yes.
                                 [used for FSFS and FSX repositories only]
      --cache-fulltexts ARG    : enable or disable caching of file contents
                                 Default is yes.
                                 [used for FSFS and FSX repositories only]
      --cache-revprops ARG     : enable or disable caching of revision properties.
                                 Consult the documentation before activating this.
                                 Default is no.
                                 [used for FSFS and FSX repositories only]
      --client-speed ARG       : Optimize network handling based on the assumption
                                 that most clients are connected with a bitrate of
                                 ARG Mbit/s.
                                 Default is 0 (optimizations disabled).
      --block-read ARG         : Parse and cache all data found in block instead
                                 of just the requested item.
                                 Default is no.
                                 [used for FSFS repositories in 1.9 format only]
      -T [--threads]           : use threads instead of fork [mode: daemon]
      --min-threads ARG        : Minimum number of server threads, even if idle.
                                 Capped to max-threads; minimum value is 0.
                                 Default is 1.
                                 [used only with --threads]
      --max-threads ARG        : Maximum number of server threads, even if there
                                 are more connections.  Minimum value is 1.
                                 Default is 256.
                                 [used only with --threads]
      --foreground             : run in foreground (useful for debugging)
                                 [mode: daemon]
      --single-thread          : handle one connection at a time in the parent
                                 process (useful for debugging)
      --log-file ARG           : svnserve log file
      --pid-file ARG           : write server process ID to file ARG
                                 [mode: daemon, listen-once]
      --tunnel-user ARG        : tunnel username (default is current uid's name)
                                 [mode: tunnel]
      -h [--help]              : display this help
      --virtual-host           : virtual host mode (look for repo in directory
                                 of provided hostname)
      --version                : show program version information
      -q [--quiet]             : no progress (only errors) to stderr

    svnserve 명령어의 --help 옵션을 통해서 해당 명령어를 어떻게 사용할 수 있는지 확인해봅니다. 생각보다 구체적으로 나와있어서 저것만 확인해도 왠만큼 사용할 수 있을 것 같습니다.

     

    SVN server 실행

    # svnserve -d -r /SVN

    그리고 svnserve 명령어(svnserver가 아닙니다!! 맨 뒤에 r이 없습니다)를 통해서 데몬을 켜줍니다. 데몬으로 사용하기 위해서 -d 옵션을 주고 추가로 -r 옵션을 사용해서 SVN repository로 제공할 디렉터리를 지정해줍니다.

    ※ SVN 디렉터리는 처음에 설정한 환경에 따라서 위치가 달라질 수 있습니다. 저의 경우에는 root 디렉터리 바로 아래에 SVN 이라는 디렉터리를 만들어서 사용해주고 있었습니다.

     

    SVN 정상동작 확인

    # ps -ef | grep svn
    root      5561     1  0 10:43 ?        00:00:00 svnserve -d -r /SVN

    자 이제 정상적으로 SVN process(daemon)가 돌아가고 있는지 확인하고 svn client 에서 접근이 가능한지 svn update를 해봅니다.

    반응형