Ubuntu下设置svn开机自启与遇到的错误

svn设置开机自启

  • 本人的svn安装在 /var/svn

切换目录,创建shell脚本

	cd /etc/init.d/			//切换目录	
	vi startsvn.sh			//创建一个shell脚本

脚本内容

	#!/bin/bash
	svnserve -d -r /var/svn		//启动svn服务的目录

添加到启动项

	update-rc.d startsvn.sh defaults
	注:若出现sudo update-rc.d startsvn.sh defaults 95,其中数字代表的是脚本启动的顺序号,可按照自己的需要进行修改

卸载启动脚本的方法

	cd /etc/init.d/
	sudo update-rc.d startsvn.sh remove

相关错误及处理

  1. script ‘startsvn.sh’ is not an executable regular file, skipped!
  • 首先尝试:chmod +x startsvn.sh
  • 将启动指令修改为:sudo update-rc.d startsvn.sh defaults
  1. script ‘startsvn.sh’ missing LSB tags and overrides
  • 这是一个wanning
  • 可以去查找一下:/etc/init.d/skeleton 文件,它的开头有两个标记 ### BEGIN INIT INFO 和 ### END INIT INFO
  • 将标记中的内容加到你写的脚本之中
#!/bin/bash
### BEGIN INIT INFO
# Provides:          skeleton
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.  This example start a
#                    single forking daemon capable of writing a pid
#                    file.  To get other behavoirs, implemend
#                    do_start(), do_stop() or other functions to
#                    override the defaults in /lib/init/init-d-script.
### END INIT INFO
  1. 开机未启动
  • 可以尝试修改一下文件的权限:sudo chmod 755 /etc/init.d/startsvn.sh
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值