linux - 由于 rc.local 启动脚本而无法启动

标签 linux svn virtual-machine startupscript

环境:

虚拟化软件:VMware Workstation 12 Player

客户机:Red Hat 6.4

主机:Windows 7 Professional Service Pack 1

问题:

我正在尝试在虚拟机启动时自动执行 svn 更新。我像这样编辑了 rc.local 文件:

#!/bin/sh -e
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't 
# want to do the full Sys V style init stuff.

sleep 10

svn update path/to/repository

exit 0

但是这样虚拟机将无法启动,它会继续加载(如果我删除 svn 命令行,就没有问题)。如果我尝试关闭或重新启动 guest ,我们可以看到以下内容:

Guest machine window

所以这意味着svn命令被执行了但是没有起作用。我已经尝试编写“svn update --username user --password xxx”但结果相同。如何让 svn 命令运行?

最佳答案

如果您在 /etc/init.d/svnserve 中创建文件会怎样

#!/bin/bash 
### BEGIN INIT INFO 
# Provides:          svnserve 
# Required-Start:    $local_fs $remote_fs $network $syslog 
# Required-Stop:     $local_fs $remote_fs $network $syslog 
# Default-Start:     2 3 4 5 
# Default-Stop:      0 1 6 
# X-Interactive:     true 
# Short-Description: Start/stop svnserve 
### END INIT INFO 

svnserve -d -r /PATH/TO/YOUR/REPOSITORY

使其可执行:

chmod u+x /etc/init.d/svnserve

创建从运行级别到脚本的链接:

 update-rc.d svnserve 

然后检查链接是否正确创建

find /etc/ -name '*svnserve*'

最诚挚的问候

Xsi

关于linux - 由于 rc.local 启动脚本而无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35866664/

相关文章:

linux - Perforce 客户端权限

java - 当我在 Eclipse 中创建新项目时,为什么 SVN Checkout 不适合我?

svn - 您如何组织版本控制存储库?

ubuntu - 将数据集从我的 PC 上传到 Google Cloud Platform 上的虚拟机实例的最佳方式

C++如何检测您的应用程序正在运行的虚拟机具有焦点

bash - 在虚拟机中运行脚本,但从虚拟机外部调用

linux - 错误 : Lapack library not found in compile time (zerobrane, lua,手电筒)

linux - 如何在 shell 脚本中检查这种情况?

SVN post-commit hook 修改外部

linux - 您可以将 Amazon EBS 附加到多个实例吗?