环境:
虚拟化软件: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 ,我们可以看到以下内容:
所以这意味着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/