centos7 svn 开机起动

  1. 在/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 --daemon --pid-file=/run/svnserve/svnserve.pid -d -r /home/svn  #一定要写svnserve命令的绝对路径
[Install]
WantedBy=multi-user.target
  1. 执行
systemctl enable svnserve.service
  1. 其它
    [Unit]:服务的说明
    Description:描述服务After:描述服务类别
    [Service]服务运行参数的设置
    Type=forking是后台运行的形式ExecStart为服务的具体运行命令ExecReload为重启命令ExecStop为停止命令PrivateTmp=True表示给服务分配独立的临时空间注意:[Service]的启动、重启、停止命令全部要求使用绝对路径

启动svnserve服务

systemctl start svnserve.service

设置开机自启动

systemctl enable svnserve.service

停止开机自启动

systemctl disable svnserve.service

查看服务当前状态

systemctl status svnserve.service

重新启动服务

systemctl restart svnserve.service

查看所有已启动的服务

systemctl list-units --type=service

你可能感兴趣的:(centos7 svn 开机起动)